CSS Tutorial

CSS Style

CSS Layout Style

CSS Float Style

CSS Reference

CSS :last-of-type Selector

What is :last-of-type Selector?

CSS :last-of-type selector matches last sibling of its type in child elements of an parent element.

Browser Compatibility

  • Google Chrome 2+
  • Mozilla Firefox 3+
  • Internet Explorer 9+
  • Opera 9.5+
  • Safari 4+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.


General syntax of :last-of-type selector,

element:last-of-type {
	property: value;
	property: value;

/* match all last sibling of its type child element */
*:last-of-type {
	property: value;
	property: value;


CSS :last-of-type selector select all last sibling of its type child element.

<style type="text/css">
div :last-of-type {   /* div *:last-of-type */
        <span>This is first span</span>
        <span>This is second span</span>
            <li>This is first line</li>
            <li>This is second line</li>
        <p>First Paragraph</p>
        <p>Second Paragraph</p>	

Run it...   »

Example Result: