使用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 60岁长辈祝福语简短
11 新婚抖音祝福语简短
12 幽默小姐姐祝福语简短
13 简短有力的结婚祝福语
14 生日祝福语简短而有深意
15 简短有内涵的祝福语
16 舅舅大婚文案祝福语简短
17 生日祝福语男孩 简短独特
18 牛年佛家祝福语大全简短