2
first-of-typeと:last-of-typeセレクタは、以下のスニペットのように動作する理由を説明できますか?データ型のlast-of-typeセレクタの動作
https://codepen.io/anon/pen/jaxQNJ
HTML
<div class="container">
<h2 data-type data-type-a>A (should be black/is black)</h2>
<h2 data-type data-type-a>A (should be red/is black)</h2>
<h2 data-type data-type-b>B (should be green/is black)</h2>
<h2 data-type data-type-b>B (should be blue/is blue)</h2>
</div>
CSS
div{
color:black;
font-weight:bold;
}
.container h2[data-type]:last-of-type{
color:blue;
}
.container h2[data-type-a]:last-of-type{
color:red;
}
.container h2[data-type-b]:first-of-type{
color:green;
}