Noname
Noname

Reputation: 15

CSS > (selector) not working

Why is this piece of code not working? Only the li items in the first ul in the #menu should be red.

.l-branding .l-region #menu > ul li {background: red;}

Upvotes: 1

Views: 53

Answers (1)

dfsq
dfsq

Reputation: 193271

Only the li items in the first ul in the #menu should be red.

Then you need to use :first-of-type or :first-child selector to make the first ul red:

.l-branding .l-region #menu > ul:first-of-type li {background: red;}

Demo: https://jsfiddle.net/o1muekkj/

Upvotes: 1

Related Questions