CSS/Selectors/pseudo-classes/:last-of-type

From W3C Wiki
< CSS‎ | Selectors

Pseudo-class :last-of-type

The :last-of-type pseudo-class represents an element that is the last sibling of its type in the list of children of its parent element. Same as :nth-last-of-type(1).

Syntax

selector:last-of-type{ properties }


Example

The following selector represents the last data cell td of a table row tr:

[style.css]

 tr > td:last-of-type{
   color: red;
 }


[index.html]

<body>
  <table>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
    </tr>
    <tr>
      <td>4</td>
      <td>5</td>
      <td>6</td>
    </tr>
  </table>
</body>

CSS defines the :last-of-type pseudo-class selector in 6.6.5.9. :last-of-type pseudo-class.