4 ms·
The first simple thing is to avoid element level selectors, stick to class names as much as possible. Another is to namespace your CSS.
by talmand 10y ago
The first simple thing is to avoid element level selectors, stick to class names as much as possible. Another is to namespace your CSS.
- pothibo 10y agoElement level selectors are so often demonized and having written quite a bit of CSS in my life, I have come to appreciate how easy it is to write and maintain CSS when you actually use those element level selectors mixed with relationship selectors ( >, +, ~,) and attribute selectors.
- talmand 10y agoI don't demonize them, I use them too. But if you rely on them too much then eventually it causes problems. Especially on a large project that grows over time in CSS and HTML. Attribute selectors are indeed handy and are on par with class names in my suggestion.