选择器:last-child
收藏:0
阅读:81
CSS3 :last-child 选择器
实例
指定父元素中最后一个p元素的背景色:
p:last-child
{
background:#ff0000;
}
{
background:#ff0000;
}
定义和用法
:last-child选择器用来匹配父元素中最后一个子元素。
提示: p:last-child等同于p:nth-last-child(1)。
浏览器支持
所有主流浏览器都支持last-child选择器。
注意: :last-child 不支持 IE8 及更早的IE版本。