4 ms·
For me the biggest goal is fewer lines to organize in the first place rather than any particular scheme for grouping. What I do is: 1) Use as few separate styl
by kj12345 16y ago
For me the biggest goal is fewer lines to organize in the first place rather than any particular scheme for grouping. What I do is:
1) Use as few separate stylesheets site-wide as possible so any contradicting or repetitive rules will be obvious.
2) Use one line per rule so I can scan the selectors quickly, then scroll horizontally if necessary
3) I prefer complex comma-separated selectors which set one or two properties to simple selectors which set many properties. Grouping in this way gets me closer to having constants, e.g. a specific hex color won't be rewritten again and again, it will just follow a complex selector list.
4) Once a selector works, I try to make it more general, e.g. "div.info { font-size: 12px }" can probably just be ".info { font-size: 12px }". More general rules will apply in more cases, so fewer overall rules will be necessary.
- 0p9 16y ago2) Use one line per rule so I can scan the selectors quickly, then scroll horizontally if necessary I'm going to finally start turning off text wrap. You've opened my eyes to this. Thanks for sharing.