1.父子选择器
#style2{ font-weight: 30px; background-color: silver; color: black; } /*父子选择器*/ #style2 span{ font-style: italic; color: red; }
#style2 span span{
font-size: 50px; }
html:
<span id="style2">这是一则<span>非常<span>重要</span></span>的新闻</span><br/>
1.子选择器标签要是可以识别的
2.父子选择器可以多级的
3.父子选择器可以适用于其他的选择器
4.如果一个元素被id class同时修饰,id的优先级高于class
<span class="hello" id="special">新闻一</span>
5.一个元素最多有一个id选择器,但可以有多个类选择器
希望新闻三是下划线、同时是斜体
a.给新闻三配置id选择器
b.再指定类选择器
<span class="hello style3">新闻二</span>
class hello与class style3那个为准?
css文件中记录那个排在最后以哪个为准
6. 优先级id>css>html
7.在有些css文件中,我们可以将多个选择器共同的内容整合