有多行不止是两行的时候,除了last-child和first-child还可以用nth-child()来修饰。
<head>
<meta charset="UTF-8">
<title>伪类选择器1</title>
<style>
p:first-child{
color: red;
}
p:last-child{
color: blue;
}
p:nth-child(2){
color: yellow;
}
</style>
</head>
<body>
<p>some text</p>
<p>some text</p>
<p>some text</p>
</body>