h2, p {color:gray;}
<p class="important warning">
This paragraph is a very important warning.
</p>
.important.warning {background:silver;}
<planet>Venus</planet>
<planet moons="1">Earth</planet>
<planet moons="2">Mars</planet>
planet[moons] {color:red;}
<h1>This is a <em>important</em> heading</h1>
h1 em {color:red;}
<h1>This is <strong>very</strong> <strong>very</strong> important.</h1>
<h1>This is <em>really <strong>very</strong></em> important.</h1>
h1 > strong {color:red;}
h1 + p {margin-top:50px;}
- 选择器分组:不同标签具有相同属性
- 多类选择器:一个标签中可能还有多个类名
- 属性选择器
- 后代选择器
- 子元素选择器
- 相邻兄弟选择器