Re:Ask HN: Anyone have a really smart way to organize css?
by STHayden on Sunday March 27, 2011 @10:33PM
(#2376864)
To be honest. With firebug's ability to tell me what line and css files the style on an element is coming from I don't find spending a lot of time on organization to have a ton of benefit.
[ Parent
| on HN ]
Re:Ask HN: Anyone have a really smart way to organize css?
by j79 on Sunday March 27, 2011 @10:39PM
(#2376878)
While I love Firebug, I'd have to counter that organization with CSS is actually quite important (and does have its benefits!)
This is especially true when you're working either in a team environment or on a large site. The very nature of CSS (and how things cascade down) can become a nightmare when organization isn't taken into account from the start.
Re:Ask HN: Anyone have a really smart way to organize css?
by steverenz on Sunday March 27, 2011 @11:45PM
(#2377045)
I agree completely, especially on a web app that is constantly growing. 2 on-the-job things that help me the most are:
1. Using the 960 grid system (or your preferred grid flavor) 2. Grouping by the following:
Body Typography Forms (Other global stuff like links and buttons) /* Layout Element 1 / ID1 {} ID2 {} class1 {} class2 {} / Layout Element 2 */ ID3 {} ID4 {} class3 {} class4 {}
I also write my styles on one line, but that's just personal preference. I find it easier to scan down for the selector, then across for the property I want. I definitely don't do it for aesthetics or file size ;)