<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
li:last-child
{
color: red;
}
.box1 p:last-child
{
color: blue;
}
.box1 p:first-child
{
color:yellow;
}
</style>
</head>
<body>
<ul>
<li>a1</li>
<li>a2</li>
<li>a3</li>
<li>a4</li>
<li>a5</li>
</ul>
<div class="box1">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
</div>
</body>
</html>
核心:first-child:第一个,所在元素的哦
last-child:最后一个,所在元素的哦
最后
以上就是欣慰烤鸡最近收集整理的关于详解:last-child first-child 5的全部内容,更多相关详解:last-child内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复