概念
CSS 预编译器,扩展了 CSS 语言,添加导入、变量、混合、嵌套、运算等功能。
Importing (导入)
@import "library"; // library.less
@import "typo.css";
Variables (变量)
@nice-blue: #5b83ad;
#header {
color: @nice-blue;
}
Mixins (混合)
.bordered {
border-top: dotted 1px black;
border-bottom: solid 2px black;
}
#menu a {
color: #111;
.bordered;
}
嵌套
#header {
color: black;
.logo {
width: 300px;
}
&:after {
// ...
}
}
运算
加减乘除
@base: 5%;
@filler: @base * 2;
@other: @base + @filler;
color: #888 / 4;
更多Less语言特性:http://lesscss.cn/features/