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