Skip to content

CSS :last-child selector

CSS has a selector :last-child which will apply styles to the last matching element. Assume that you have this CSS and HTML code:

In this example the last paragraph will get a red background.

[sc name=”src” url=”https://www.w3schools.com/cssref/sel_last-child.asp” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.