1
<ul>
     <li>This
          <li>and this</li>
     </li>
</ul>

I try to select the second <li> by doing:

li li {
    background: "red";
}

Why doesn't it work?

user3681138
  • 337
  • 1
  • 3
  • 9

1 Answers1

4

You are missing one ul... And the document is not valid HTML5. Try this one (this is a proper way of nesting lists):

<ul>
     <li>This
         <ul>
             <li>and this</li>
         </ul>
     </li>
</ul>

Then in CSS:

ul li ul li {
    background: "red";
}

More to read here: Proper way to make HTML nested list?

Best regards, hope it helps!

Community
  • 1
  • 1
Jacek Kowalewski
  • 2,761
  • 2
  • 23
  • 36