DEV Community

Discussion on: Do you use the :not() pseudo-class?

Collapse
 
khejit68 profile image
khejit68

I commonly use the same pattern with :first-child and :last-child. I think it's great.

Collapse
 
cchana profile image
Charanjit Chana

I would be surprised if it wasn't the most common approach to be honest, but have you ever considered using :not?

Collapse
 
khejit68 profile image
khejit68

I meant I write the same stuff as your example:

ul li:not(:last-child) {
border-bottom: 1px solid silver;
}