文章浏览阅读5.4k次。CSS3 :last-child 选择器:last-child 选择器用来匹配父元素中最后一个子元素。eg:指定父元素 ul 中最后一个 li 元素,并设置背景颜色:li:last-child { background-color: #ff0000;}_css last-child...
2024-02-19 03:18 阅读 阅读全文文章浏览阅读7.7k次,点赞6次,收藏17次。转载!!!原文地址:https://blog.csdn.net/weixin_44710964/article/details/104502602?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.control&spm=1001.2101.3001.4242last-child选择器查了下W3C......
2024-02-19 03:20 阅读 阅读全文文章浏览阅读6.3k次,点赞10次,收藏21次。html<div class="list"> <div></div> <div></div> <div></div></div><style>.list div{ width: 500px; height: 20px; margin-top: 5px; border: 1px solid #000;}</style>选择全部.li......
2024-02-19 03:19 阅读 阅读全文文章浏览阅读535次。结论:1.:last-child表示其父元素的最后一个子元素,且这个元素是css指定的元素,才可以生效2.:last-of-type表示其父元素下的最后一个指定类型的元素,不必要求父元素最后一个子元素与css指定元素一样:last-child......
2024-02-19 03:18 阅读 阅读全文