Select element using its ID without the high specificity of the ID selector
suggest changeThis 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.
HTML:
<div id="element">...</div>
CSS
#element { ... } /* High specificity will override many selectors */
[id="element"] { ... } /* Low specificity, can be overridden easily */
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents