首页试题详情
难度: 使用次数:138更新时间:2026/03/16
1.
以下哪一个伪类可以选择一个元素的最后一个子元素?
A.:last-child
B.:last-of-type
C.:nth-last-child(1)
D.:only-child
题型:选择题 知识点:第二章 CSS样式表
【答案】
A
【解析】
:last-child 伪类选择的是元素的最后一个子元素,不管其类型是什么。:last-of-type 则是选择最后一个特定类型的子元素,:nth-last-child(1) 是等同于 :last-child 的语法变体,而 :only-child 是用于选择唯一的子元素。

查看答案和解析

支付 ¥0.1 即可查看此题答案和详细解析

低至 ¥0.1 起

类题推荐:

未分类