您的位置:首页 > 其它

nth-of-type选择器

2016-05-24 22:51 183 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style type="text/css">
p{
background: blue;
width: 50px;
height: 50px;
}
h4{width: 50px;height: 50px;background: yellow;}
.box p:nth-child(3){
background: red;
}
/* .box p:nth-of-type(3){
background: pink;
} */
</style>
</head>
<body>
<div class="box">
<p></p>
<p></p>
<h4></h4>
<div></div>
<p></p>
<p></p>
<p></p>
</div>
<h3>分割线</h3>
<div class="box">
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: