Blog Post

Decreasing Specificity Weapons

Most often you need to increase specificity, but every once in a while you need to decrease it. You could use a class instead of an id, but that might be that much more clutter or maybe you can’t change the HTML. One way to do it is instead of using the id of the element, you can use an attribute selector to select the id, reducing it to class specificity while still selecting the exact id you want.

<div id="zombie"></div>Code language: HTML, XML (xml)
[id="zombie"] {  }Code language: JSON / JSON with Comments (json)