From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/_colon_last-child/index.html | 71 ++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 files/zh-cn/web/css/_colon_last-child/index.html (limited to 'files/zh-cn/web/css/_colon_last-child') diff --git a/files/zh-cn/web/css/_colon_last-child/index.html b/files/zh-cn/web/css/_colon_last-child/index.html new file mode 100644 index 0000000000..e4720413c3 --- /dev/null +++ b/files/zh-cn/web/css/_colon_last-child/index.html @@ -0,0 +1,71 @@ +--- +title: ':last-child' +slug: 'Web/CSS/:last-child' +translation_of: 'Web/CSS/:last-child' +--- +
{{CSSRef}}
+ +

概述

+ +

:last-child CSS 伪类 代表父元素的最后一个子元素。

+ +

语法

+ +
{{csssyntax}}
+ +

示例

+ +

HTML 内容

+ +
<ul>
+  <li>此元素背景色不是lime</li>
+  <li>我的也不是lime。</li>
+  <li>我的才是lime! :)</li>
+</ul>
+ +

CSS 内容

+ +
li:last-child {
+  background-color: lime;
+}
+ +

{{EmbedLiveSample('%E7%A4%BA%E4%BE%8B', '100%', 100)}}

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSS4 Selectors', '#last-child', ':last-child')}}{{Spec2('CSS4 Selectors')}}No change
{{SpecName('CSS3 Selectors', '#last-child', ':last-child')}}{{Spec2('CSS3 Selectors')}}Initial definition
+ +

浏览器支持

+ + + + +

{{Compat("css.selectors.last-child")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf