第十四章 less 功能
1:less 变量
--css中的颜色和字号使用less 变量来存储
--less 变量的命名 @color:red;
--变量命名的规则:
1):必须@符号开头
2):名字不能是数字
3):名字不能包含特殊字符 @a#! @~col
4) :区分大小写
--@color:red; @n:100px; @font:font-szie:100px;
2:less 嵌套
–css写法:
#header {
color: black;
}
#header .navigation {
font-size: 12px;
}
#header .logo {
width: 300px;
}
–less写法:
#header {
color: black;
.navigation {
font-size: 12px;
}
.logo {
width: 300px;
}
}
-- 伪类或者伪类元素的写法必须加&符号
--css写法:
a:hover{
color:blue;
}
--less写法:
a{
&:hover{
color:blue;
}
}
3:运算 + - * / ()
--有括号先算括号
--按照运算的优先级运算
--单单位会按照单位显示
--60px/2=30p