CSS :last-of-type Selector Last Updated : 29 Aug, 2024 Comments Improve Suggest changes 1 Likes Like Report The :last-of-type Selector is used to target the last child element of the same type of it's parent for styling. This selector is same as ":nth-last-of-type". Syntax::last-of-type { //property}Example: HTML <!DOCTYPE html> <html> <head> <style> p:last-of-type { background: limegreen; color: white; font-style: italic; font-size: 1.875em; } </style> </head> <body> <h3>I am heading.</h3> <p>I am first child.</p> <h3>I am heading.</h3> <p>I am second child.</p> <h3>I am heading.</h3> <p>I am third child.</p> <h3>I am heading.</h3> <p>I am last child.</p> <h3>I am heading.</h3> </body> </html> Output: Supported Browsers:Google Chrome 1.0Edge 12.0Firefox 3.5Safari 3.1Opera 9.5 Create Quiz Comment V Vishal_Khoda Follow 1 Improve V Vishal_Khoda Follow 1 Improve Article Tags : Misc Web Technologies CSS CSS-Selectors Explore CSS Introduction 3 min read CSS Syntax 3 min read CSS Selectors 6 min read CSS Comments 2 min read CSS Colors 5 min read CSS Borders 5 min read CSS Margins 4 min read CSS Height and Width 4 min read CSS Outline 4 min read CSS Fonts 4 min read Like