# :last-of-type 和 :first-of-type的误用
someselector:last-of-type不仅与someselector这个选择器相关,还与符合该选择器的元素的标签相关。
再看一下W3C的说明:
> The :last-of-type pseudo-class represents an element that is the last sibling of its type in the list of children of its parent element.
>
这里所谓 the last sibling of its type其实讲得并不是很清楚,但仔细琢磨,这里的type的意思应该就是不仅仅与选择器相关,还与标签相关。
<iframe width="100%" height="300" src="//jsrun.net/GBiKp/embedded/all/light/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
从中可以看出,选择器首先会找到父元素下相同的标签,如果class相同,则选中,否则不会选中。