Less知识点整理(一)

Less知识点整理(一)

1.什么是Less

它不是全新的一门语言,是一款CSS预编译器,仍然使用CSS原有语法进行选择器的编辑,但融入了编程语言的逻辑特征,会生成易于管理、便于维护的CSS代码,也可以理解为是一个CSS框架。

优点:

  • CSS代码量会变少
  • CSS管理更加方便
  • 学习成本低
  • 使用数值类型与颜色类型的值更为容易
  • 完全兼容CSS3
  • 内置函数特征

编译前:

@color:orange;
@mywidth:300px;
.circule(){
   
  border-radius:50%;
}
.middle(){
   
  position: absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
}

.father{
   
   width: @mywidth;
   height: @mywidth;
   background-color: @color;
   .circule;
   position: relative;
   .son{
   
     width: @mywidth * 0.75;
     height: @mywidth * 0.75;
     background-color: lighten(@color,30%);
     .circule;
     .middle;
   }
}

编译后:

.father {
   
  width: 300px;
  height: 300px;
  background-color: orange;
  border-radius: 50%;
  position: relative;
}
.father .son {
   
  width: 225px;
  height: 225px;
  background-color: #ffdb99;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值