【问题标题】:last-child/last-of-type And [attr|=value]/[attr^=value] [closed]最后一个孩子/最后一个类型和 [attr|=value]/[attr^=value] [关闭]
【发布时间】:2015-06-21 10:29:25
【问题描述】:

例如 p:last-child 选择器和 p:last-of-type 选择器有什么区别?

例如 p[class|"hello"] 和 p[class^="hello"] 之间还有什么区别

【问题讨论】:

标签: css css-selectors


【解决方案1】:

正如您所料,p:last-child 匹配最后一个子元素,p:last-of-type 匹配该类型的最后一个元素。
p[class|"hello"]p[class^="hello"] 的区别在于前者不是有效的选择器,而后者是。
另外,请参阅对您的问题的评论。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-12
    • 2012-02-09
    • 2012-06-28
    • 2012-10-09
    • 2022-11-10
    • 2011-04-18
    相关资源
    最近更新 更多