I tested the following code, and don't know why the same HTML Structure is not working in a list. Inside the div
container with the p
everything works fine. Only the p
inside .level1
class gets bold
. But same structure inside a ul
doesn't work. Why is also the li
element inside the .level2
class bold
?
<ul class="level1">
<li>Level 1</li>
<li>Level 1</li>
<li>Level 1
<ul class="level2">
<li>Level 2</li>
<li>Level 2</li>
</ul>
</li>
<li>Level 1</li>
</ul>
<div class="level1">
<p>Level 1</p>
<p>Level 1</p>
<p>Level 1
<div class="level2">
<p>Level 2</p>
<p>Level 2</p>
</div>
</p>
<p>Level 1</p>
</div>
.level1 > li {
font-weight: bold;
}
.level1 > p {
font-weight: bold;
}