Robin Cox
Robin Cox

Reputation: 1490

css direct-child selector chooses all childs at all levels

this css code should only color the background of li tags directrly under the topUl, but it colors the background of all li in the whole unordered list:

ul.topUl > li {
    background-color: #ff0 !important;
}

What am I doing wrong?

Upvotes: 0

Views: 41

Answers (1)

Quentin
Quentin

Reputation: 944157

Presumably, you haven't change the background colour of the descendant li elements from the default of transparent.

Upvotes: 1

Related Questions