Why in the following code world
is blue rather than red ?
The specificity of .my_class
is 0,0,1,0
, but it inherits the color of #my_id
which specificity is higher (0,1,0,0
).
HTML:
<p id='my_id'>
Hello
<span class='my_class'>
world
</span>
</p>
CSS:
#my_id {
color: red;
}
.my_class {
color: blue;
}