最佳答案
我分辨不出 element:first-child
和 element:first-of-type
的区别
例如,你有一个 div
div:first-child
→作为父元素第一个子元素的所有 <div>
元素。
div:first-of-type
→所有作为其父元素的第一个 <div>
元素的 <div>
元素。
这看起来完全一样,但它们的工作原理不同。
有人能解释一下吗?