【发布时间】:2015-06-21 10:29:25
【问题描述】:
例如 p:last-child 选择器和 p:last-of-type 选择器有什么区别?
例如 p[class|"hello"] 和 p[class^="hello"] 之间还有什么区别
【问题讨论】:
-
你可以在 w3schools 中看到这些。
标签: css css-selectors
例如 p:last-child 选择器和 p:last-of-type 选择器有什么区别?
例如 p[class|"hello"] 和 p[class^="hello"] 之间还有什么区别
【问题讨论】:
标签: css css-selectors
正如您所料,p:last-child 匹配最后一个子元素,p:last-of-type 匹配该类型的最后一个元素。p[class|"hello"] 和 p[class^="hello"] 的区别在于前者不是有效的选择器,而后者是。
另外,请参阅对您的问题的评论。
【讨论】: