What is the difference when using the operator?

1

What is the difference between using the > selector and not using it? , since I see the same result.

ul > li {
 color: red;
}

ol li {
 color: blue;
}
<ul>
<li>Hola</li>
</ul>

<ol>
<li>Chau!</li>
</ol>
    
asked by Eduardo Sebastian 13.10.2017 в 03:34
source

1 answer

3

Assigns style to each li where the parent element is ul

ul > li {
 color: red;
}

ol li {
 color: blue;
}
<ul>
<span><li>Chau!</li></span>
</ul>

<ol>
<span><li>Chau!</li></span>
</ol>
    
answered by 13.10.2017 / 03:54
source