CSS的作用:nth-child(n)选择器
使用CSS:nth-child(n)选择器来设置每个<p>元素的样式,这些元素是使用CSS父元素的第二个子元素。您可以尝试运行以下代码来实现:nth-child(n)选择器
示例
<!DOCTYPE html>
<html>
<head>
<style>
p:nth-child(4) {
background: orange;
color: white;
}
</style>
</head>
<body>
<p>This is demo text 1.</p>
<p>This is demo text 2.</p>
<p>This is demo text 3.</p>
<p>This is demo text 4.</p>
<p>This is demo text 5.</p>
<p>This is demo text 6.</p>
</body>
</html>热门推荐
9 祝福语简短古诗词
10 学生节祝福语大全简短
11 新年祝福语短句简短搞笑
12 离校退群祝福语简短
13 虎年公司祝福语简短的
14 团队文案祝福语简短励志
15 酒桌升学祝福语简短
16 生日牌祝福语英语简短
17 春节感恩祝福语简短的
18 女神节日简短祝福语大全