在下面摘自Twitter Bootstrap的CSS中,与号(&;)字符是什么意思?
.clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
}
在下面摘自Twitter Bootstrap的CSS中,与号(&;)字符是什么意思?
.clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
}
那是LESS,不是CSS.
此语法允许您嵌套 Select 器修饰符.
.clearfix {
&:before {
content: '';
}
}
将编译为:
.clearfix:before {
content: '';
}
With the &
, the nested selectors compile to .clearfix:before
.
Without it, they compile to .clearfix :before
.