我试图选择所有具有.checked
和.featured
标签的元素。因此,基本上,我要寻找的是“和”选择器;我不知道有没有。
对于这种情况,有什么解决方法吗?
Answers:
两者都使用(它们之间没有空格)
.checked.featured{
// ...
}
参考:http : //www.w3.org/TR/selectors/#class-html
例
div{margin:1em;padding:1em;}
.checked{color:green;}
.featured{border:1px solid #ddd;}
.checked.featured{
font-weight:bold;
}
<div class="checked">element with checked class</div>
<div class="featured">element with featured class</div>
<div class="featured checked">element with both checked and featured classes</div>
#pie table, #bars table {}
h4
同时h5
具有两个类的和元素,则h4.checked.featured, h5.checked.featured{...}
需要使用,
多个选择器
.main [:hover,ul,ul>li,p] { display:inline-block;}