Good CSS Practice

Use minimum number of selectors

<div id="infoContainer">
    <div class="info">
        <span class="name">Mossaddeque Mahmood</span>
    </div>
</div>
#infoContainer .info .name {
    color:red;
}
.info .name {
    color:red;
}
.name {
    color:red;
}

If I want to set color red to only my name then last css selector ".name" is better then ".info .name", and ".info .name" is better then "#infoContainer .info .name". Because more specific selector have bigger specificity value.

css
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License