【css】:last-child 选择器

CSS3:last-child选择器

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

eg:指定父元素 ul 中最后一个 li 元素,并设置背景颜色:

li:last-child {
  background-color: #ff0000;
}

版权声明:本文为weixin_42163902原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。