CSS的作用:最后选择器
使用CSS:last-child选择器设置每个<p>元素的样式,这些元素是其父元素的最后一个子元素。
示例
您可以尝试运行以下代码来实现:last-child选择器-
<!DOCTYPE html>
<html>
<head>
<style>
p:last-of-type {
background: orange;
}
</style>
</head>
<body>
<h2>Heading</h2>
<p>This is demo text1.</p>
<p>This is demo text2.</p>
<p>This is demo text3.</p>
</body>
</html>热门推荐
10 毕业英语祝福语大全简短
11 财运健康成语祝福语简短
12 2026祝福语简短创意牛
13 60岁长辈祝福语简短
14 生日祝福语简短搞笑女儿
15 餐前仪式祝福语简短
16 姨父生日祝福语简短精辟
17 中考祝福语简短高级句
18 结婚祝福语亲姐姐简短