How to use a not:firstchild Selector in CSS? (original) (raw)
How to use a not:first-child Selector in CSS?
Last Updated : 9 Oct, 2024
The ****:not(:first-child) selector in CSS** targets all elements that are not the first child within their parent. It allows you to style elements except the first one, making it useful for applying styles to subsequent items in a list or layout.
**Syntax
:not( element ) { // CSS property }
**Example: In this example, we are using the not:first-child selector to select the non-first child from the parent element. It contains
- Tag so it selects all child elements of
tag except its first child.
HTML `
not first child selector