Don’t use ID selectors in CSS
Lately I have been testing out performance among css styles and I found that some of my very smart friends, started asking,”why aren’t you testing using IDs for the unique sections of the page?”.
This wasn’t a hard answer:
- The element is not re-usable on that page.
- This is the begining of a downward sprial into specificity
- Usually, IDs refer to something very specific, and abstracting would be tough
- Any performance gains picked up by using id, is negated by adding any other selector to the left fo that id
Von decodering gerebloggt
Tags: HTML/CSS