3 ms·
I'd recommend adding: * Alphabetize properties within each CSS rule To here: https://github.com/styleguide/css https://github.com/styleguide/css
by davidcann 15y ago
I'd recommend adding:
* Alphabetize properties within each CSS rule
To here: https://github.com/styleguide/css https://github.com/styleguide/css
- zefhous 15y agoI strongly prefer logically grouping related styles. The only advantage from alphabetizing rules is perhaps slightly faster scanning of rules, but I don't think it is even very helpful in doing that. You generally don't have that many rules in a single style anyway so it's not a problem that needs solving. However, by grouping related styles I think there are a some small yet worthwhile advantages. Grouped styles can reveal intention, while alphabetizing does not at all. Grouped styles can also make refactoring quicker and less tedious.
- davidcann 15y agoI would agree with that if there were a defined, consistent logic, but I've never seen that done well across multiple developers. After switching to alphabetized rules, my CSS feels much more organized and I'd say is much easier to scan and refactor.
- obtu 15y agoRules order has meaning in CSS: everything else being equal, the last declared rule has precedence.