Consider the following HTML snippet
<div class="my-cool-section">
<div>
<div>
<ul>
<li>List</li>
<li>Of some</li>
<li>Stuffs</li>
</ul>
</div>
</div>
</div>
Is it a bad CSS if I define the style for the li
items like this?
.my-cool-section ul li {
//Styles for the items
}
According to my code reviewer the BEST solution is to attach a class directly to the ul
IF NOT li
. The super ideal case would be to attach a class with the li
itself.
<li class="my-cool-list-item">Stuffs</li>
Like that. So is this true? If yes is it related to performance etc? Also please consider that this code would be part of a bigger compiled CSS file containing thousands of lines of code. Thanks.