Pseudo-class :last-child

The :last-child pseudo-class represents an element that is the last child of some other element. Same as :nth-last-child(1).


selector:last-child{ properties }


The following selector represents a list item li that is the last child of an ordered list ol:


 ol > li:last-child{
   color: red;


    <li>List-item 1</li>
    <li>List-item 2</li>
    <li>List-item 3</li>

Css3 selectors last-child.png

CSS defines the :last-child pseudo-class selector in :last-child pseudo-class.

Last modified on 26 September 2011, at 20:49