Best practice for calling classes in CSS
4 answers
div.myClassmakes style declarations more specific. In other words, it has a higher priority. Therefore, it is sometimes useful to specify it in order to avoid CSS conflicts when you have many developers on board a project and people add classes like no tomorrow. In other words, if you added Bob:
.myClass {
color: red;
}
and Sarah adds:
div.myClass {
color: blue;
}
The Sarah class will surpass the Bob class if you have:
<div class="myClass">Sarah FTW</div>
, , .:)
+9