选择器:last-child

收藏:0   阅读:81

CSS3 :last-child 选择器


实例

指定父元素中最后一个p元素的背景色:

p:last-child
{
background:#ff0000;
}


定义和用法

:last-child选择器用来匹配父元素中最后一个子元素。

提示: p:last-child等同于p:nth-last-child(1)。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持last-child选择器。

注意: :last-child 不支持 IE8 及更早的IE版本。

© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!