.box:first-child和.box :first-child的区别
![](https://img.haomeiwen.com/i9999996/5401e80af4985d2d.png)
选择一个class为box的元素,要求是:他是其父元素下的第一个元素
![](https://img.haomeiwen.com/i9999996/d1f22bdb5182b2cb.png)
选择class为box元素的第一个子元素
同理.box:first-of-type 匹配class为box的父元素下的各种标签的第一个元素
.box :first-of-type 匹配class为box的的标签下的各种标签的第一个元素
选择一个class为box的元素,要求是:他是其父元素下的第一个元素
选择class为box元素的第一个子元素
.box :first-of-type 匹配class为box的的标签下的各种标签的第一个元素
本文标题:css tips
本文链接:https://www.haomeiwen.com/subject/gzndoxtx.html
网友评论