This page is part of the CSS3.info CSS selectors test. See more info on CSS3 selectors.
div:first-of-type {
}
<div>Does this element match?</div>
The CSS selector should match the marked div element, because it is the only element of this type
div:first-of-type {
}
<div>Does this element match?</div>
<div></div>
The CSS selector should match the marked div element, because it is the first element of this type
div:first-of-type {
}
<blockquote></blockquote>
<div>Does this element match?</div>
The CSS selector should match the marked div element, because it is the first element of this type
div:first-of-type {
}
<div></div>
<blockquote>
<div>Does this element match?</div>
</blockquote>
The CSS selector should match the marked div element, because it is the first element of this type in this scope
div:first-of-type {
}
<div>
<div>Does this element match?</div>
</div>
The CSS selector should match the marked div element, because it is the first element of this type in the current scope
div:first-of-type {
}
<blockquote>
<div></div>
</blockquote>
<div>Does this element match?</div>
The CSS selector should match the marked div element, because it is the first element of this type in the current scope
div:first-of-type {
}
<div></div>
<div>Does this element match?</div>
The CSS selector should not match the marked div element, because it is the second element of this type
div:first-of-type {
}
<DIV></DIV>
<div>Does this element match?</div>
The CSS selector should not match the marked div element, because it is the second element of this type
div:first-of-type {
}
<div id='insertBefore'></div>
var ib = document.getElementById('insertBefore');
ib.parentElement.insertBefore(document.createElement("div"), ib);
The CSS selector should match the div element that is inserted by the Javascript code.
div:first-of-type {
}
<div id='insertBefore'></div>
var ib = document.getElementById('insertBefore');
ib.parentElement.insertBefore(document.createElement("div"), ib);
The original div element should not be a match for the :first-of-type selector.