:last-of-type CSS Pseudo Class

Description

The :last-of-type pseudo-class sets the style of the last element of a certain type in a group of sibling elements (having one parent).

Syntax

element:last-of-type { ... } 

Example

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,</p>
<p>quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,</p>
<p>sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
p:last-of-type { 
font-style: italic;
color: #3e79f9;
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
91213.59.53.2
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
218410.13.2X