# last-of-type pseudo-class

The `last-of-type` pseudo-class selects the element that is the last child of a parent of a given type. That is, if I'll write `h2:last-of-type` - the last `h2` in the parent will be found (unlike `last-child`, which will find only the `h2` that is the very last in the parent).

## Syntax

`selector:last-of-type { }`

## Example

Let's find the paragraph that is the last paragraph in the parent:

`<div> <h2>header</h2> <p>paragraph</p> <h2>header</h2> <p>paragraph</p> <h2>header</h2> <p>paragraph</p> </div>` `h2:last-of-type { color: red; }`

:

← →
↑
en ru