Within this code snippet, there are two nested div elements - the outer one is identified by an ID and the inner one is identified by a class:
<div id="theID">
<div class="aClass">Text inside ID</div>
</div>
Suppose we have style rules for both the class and the ID:
.aClass {color: green; }
#theID { color: yellow; }
Based on my understanding, both rules should apply to the text with higher specificity (#theID) taking precedence.
However, in this case, the class rule takes priority and the text appears green instead of yellow.
What could be causing this unexpected behavior?