css选择器:
通过各种css选择器查找和定位各种标签
1.标签选择器:直接通过标签名查找标签
p{
color: blue;
}
2.id选择器:它一般是查找某一个标签,因为id属性的值不能重复。
#p1 {
font-size: 40px;
}
3.class选择器:它一般是查找多个标签,因为class属性的值可以重复。
.pp {
color: red;
/*加粗字体*/
font-weight: bolder;
}
4.父子选择器
div > p {
/*背景色*/
background-color: red;
}
/*div下的p标签*/
5.后代选择器
body .d > a {
font-size: 30px;
}、
<body>
<div>
<p>哈哈</p>
<div class="d">
<a href="#">百度一下</a>
</div>
</div>
</body>
行内样式的优先级最高。