css中&符号的作用,是什么意思?
微wx笑
2020-04-12【网页网站】
6
0关键字:
CSS
在查看Bootstrap v3 的文档时,看到清除浮动部分代码中包含&符号,这个符号代表什么意思呢?// Mixin itself.clearfix() { &:before, &:after { content: " "; display:
在查看Bootstrap v3 的文档时,看到清除浮动部分代码中包含&符号,这个符号代表什么意思呢?
// Mixin itself
.clearfix() {
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
// Usage as a mixin
.element {
.clearfix();
}看看下面的例子你就懂了:
.bordered {
&.float {
float: left;
}
.top {
margin: 5px;
}
}等同于:
.bordered.float {
float: left;
}
.bordered .top {
margin: 5px;
}.bordered.float 是串联选择器,作用在同一标签上
.bordered .top 是后代选择器,作用在不同标签上
相关文章:
CSS样式中双引号分号斜杠空格井号波浪号逗号加号大于号各种标点符号是什么意思?
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/web/2020-04-12/393.html



