:last-child
概述
:last-child
CSS 伪类 代表父元素的最后一个子元素。
语法
:last-child
示例
HTML 内容
<ul>
<li>此元素背景色不是lime</li>
<li>我的也不是lime。</li>
<li>我的才是lime! :)</li>
</ul>
CSS 内容
li:last-child {
background-color: lime;
}
规范
Specification | Status | Comment |
---|---|---|
Selectors Level 4 :last-child |
Working Draft | No change |
Selectors Level 3 :last-child |
Recommendation | Initial definition |
浏览器支持
BCD tables only load in the browser