01-less入门

less入门

Less 是一门 CSS 预处理语言,它扩充了 CSS 语言,增加了诸如变量、混合(mixin)、函数等功能,让 CSS 更易维护、方便制作主题、扩充。

Less 可以运行在 Node、浏览器和 Rhino 平台上。网上有很多第三方工具帮助你编译 Less 源码。

例如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@charset "UTF-8";
//只会在LESS中显示
/*就会在LESS和CSS中显示*/
.conten {
ul{
list-style: none;
}
li{
height: 25px;
line-height: 25px;
padding-left: 15px;
background: url("arr.jpg") no-repeat center left;
a{
text-decoration: none;
color: #535353;
font-family: microsoft yahei, "微软雅黑", Arial, Simsun, "Arial Unicode MS", Mingliu, Helvetica;
}
}
}

编译为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@charset "UTF-8";
/*就会在LESS和CSS中显示*/
.conten ul {
list-style: none;
}
.conten li {
height: 25px;
line-height: 25px;
padding-left: 15px;
background: url("arr.jpg") no-repeat center left;
}
.conten li a {
text-decoration: none;
color: #535353;
font-family: microsoft yahei, "微软雅黑", Arial, Simsun, "Arial Unicode MS", Mingliu, Helvetica;
}

坚持原创技术分享,您的支持将鼓励我继续创作!