我在Twitter Bootstrap中看到了这个 Select 器:
.show-grid [class*="span"] {
background-color: #eee;
text-align: center;
border-radius: 3px;
min-height: 30px;
line-height: 30px;
}
有人知道这项技术叫什么,它的作用是什么吗?
我在Twitter Bootstrap中看到了这个 Select 器:
.show-grid [class*="span"] {
background-color: #eee;
text-align: center;
border-radius: 3px;
min-height: 30px;
line-height: 30px;
}
有人知道这项技术叫什么,它的作用是什么吗?
这是一个属性通配符 Select 器.在您给出的示例中,它查找.show-grid
以下的所有子元素,这些子元素的类包含span
.
因此,在本例中 Select <strong>
元素:
<div class="show-grid">
<strong class="span6">Blah blah</strong>
</div>
你也可以搜索"开始于…"
div[class^="something"] { }
这会对这样的事情起作用:-
<div class="something-else-class"></div>
并且"以……结尾."
div[class$="something"] { }
哪一个会有用
<div class="you-are-something"></div>
Good references个