[thelist] style sheet organization

Julian Rickards julian.rickards at gmail.com
Tue Oct 31 06:01:17 CST 2006


Obviously, random order of CSS works (with the exception of LVHA) but that
can get awfully confusing to edit later on.

I tend to organize my CSS rules from outer to inner, top to bottom so the
rules might look like:

html
body
#outer
#outer p
#navbar
#navbar li
#navbar a
#content
#content h1
#content h2
#content h3
...
#footer
#footer p
#footer a

I have also seen a recommendation where rules are indented to appear like a
document tree as in:

#content
 -> #content h1
 -> #content p
 -> -> #content p a

Given that CSS can be written randomly, the only recommendation we can make
is to organize it so it is easy to edit later on.

HTH,

Jules

On 31/10/06, Joel D Canfield <joel at spinhead.com> wrote:
>
> is there a recommended order in style sheets for selectors and/or
> properties? obviously stuff works more or less whatever order it's in,
> or my fairly random styles wouldn't function. but other than the
> recommendations I've found for styling links (LVHA) I can't find any
> info on when, or if, it matters what order padding, margin, float,
> width, etc. are declared.



More information about the thelist mailing list