CSS :last-of-type Pseudo-class
Example
Specify a background color for the last <p> element and the last <li> element of its parent:
p:last-of-type {
background-color: yellow;
}
li:last-of-type {
background-color: yellow;
}
Try it Yourself »
Definition and Usage
The CSS :last-of-type
pseudo-class
matches any element that is the last child of its type, of its
parent.
Tip: This is the same as :nth-last-of-type(1).
Version: | CSS3 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-class.
Pseudo-class | |||||
---|---|---|---|---|---|
:last-of-type | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |
CSS Syntax
Related Pages
CSS Reference: :last-child