学习相关

less与scss有什么区别呢?

2019-07-16  本文已影响0人  周周很可爱

less与scss是什么?
Less也是一种动态样式语言. 对CSS赋予了动态语言的特性,如变量,继承,运算, 函数. Less 既可以在客户端上运行 (支持IE 6+, Webkit, Firefox),也可在服务端运行 (借助 Node.js)。
Sass 是一种动态样式语言,Sass语法属于缩排语法,比css比多出好些功能(如变量、嵌套、运算,混入(Mixin)、继承、颜色处理,函数等),更容易阅读。

.less和scss的声明调用方法不同
//less//

  .whb(@w,@h,@back){
 width:@w;
height:@h;
background-color:@b
 }
 .center{
   margin:0 auto;
    }

less调用:

 div{
   .whb(200px,300px,red);
   .center;
    }

//scss//

 @mixin whb($w,@h,@b){
 width:$w;
 height:$h;
 background-color:$b;
@minxin center{
 margin:0 auto;
 }

scss调用

  div{
    @include whb(200px,400px,red);
    @include center;
    }
上一篇 下一篇

猜你喜欢

热点阅读