Excluding last-child

Css

Css Problem Overview


ul li:last-child selects the last element of a list.

ul li:not(...) selects an element that is not something

What is the CSS selector for excluding the last child of an element? I tried ul li:not(last-child) but it didn't work.

Css Solutions


Solution 1 - Css

Did you try:

ul li:not(:last-child)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexStackView Question on Stackoverflow
Solution 1 - CssminazView Answer on Stackoverflow