the popular point of CSS weight I know is! important > id > class > tag
I was baffled when I was doing a problem today, as shown in the figure
.
the code is as follows
< H1 > html < / H1 ><ul class="shopping-list" id="awesome">
<li><span>Milk</span></li>
<li class="favorite" id="must-buy"><span class="highlight">Sausage</span></li>
</ul>
< H1 > css < / H1 >
ul-sharpawesome {
color: red;
}
ul.shopping-list li.favorite span {
color: blue;
}
shouldn"t the color of the Sausage be red? from the weight point of view, the css above is (0Magne1) and the css below is (0mem0re2)
, but the answer is indeed blue, and it is also blue when tested on the browser.
looked up the information about the weight of CSS, and the answer was also close to red