CSS 参考手册
CSS3 :last-child 选择器
指定父元素中最后一个p元素的背景色
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> p:last-child { background: #ff0000; } </style> </head> <body> <p>The first paragraph.</p> <p>The second paragraph.</p> <p>The third paragraph.</p> <p>The fourth paragraph.</p> </body> </html>
运行结果:
点击运行 »