Select element using its ID without the high specificity of the ID selector

suggest change

This trick helps you select an element using the ID as a value for an attribute selector to avoid the high specificity of the ID selector.


<div id="element">...</div>


#element { ... } /* High specificity will override many selectors */

[id="element"] { ... } /* Low specificity, can be overridden easily */

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents