Convention for ordering a style sheet

Discussion in 'HTML' started by David Segall, Sep 23, 2009.

  1. David Segall

    David Segall Guest

    I have (almost) decided to arrange my style sheets in alphabetical
    order. It seems to work reasonably well for properties although I
    would prefer it if bounding box properties like margin and border were
    together.

    I am prepared to name classes so that similar classes are collected.
    So, for example, imageLeft and imageRight are clumsier than leftImage
    and rightImage but I can live with it.

    Can someone suggest a superior, well defined, order?
    David Segall, Sep 23, 2009
    #1
    1. Advertising

  2. David Segall

    Lars Eighner Guest

    In our last episode, <>, the
    lovely and talented David Segall broadcast on alt.html:

    > I have (almost) decided to arrange my style sheets in alphabetical
    > order. It seems to work reasonably well for properties although I
    > would prefer it if bounding box properties like margin and border were
    > together.


    > I am prepared to name classes so that similar classes are collected.
    > So, for example, imageLeft and imageRight are clumsier than leftImage
    > and rightImage but I can live with it.


    > Can someone suggest a superior, well defined, order?


    Maybe not. But what I do involves styling stuff three times. First to
    standardize stuff (such as relative heading sizes) that vary from browser to
    the browser and fix stuff like nesting of elements that are usually rendered
    in italics, then for the basic structure, and finally for pretty-pretty like
    colors and fonts.

    --
    Lars Eighner <http://larseighner.com/> September 5867, 1993
    245 days since Rick Warren prayed over Bush's third term.
    Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.
    Lars Eighner, Sep 23, 2009
    #2
    1. Advertising

  3. David Segall

    richard Guest

    On Wed, 23 Sep 2009 13:10:43 GMT, David Segall wrote:

    > I have (almost) decided to arrange my style sheets in alphabetical
    > order. It seems to work reasonably well for properties although I
    > would prefer it if bounding box properties like margin and border were
    > together.
    >
    > I am prepared to name classes so that similar classes are collected.
    > So, for example, imageLeft and imageRight are clumsier than leftImage
    > and rightImage but I can live with it.
    >
    > Can someone suggest a superior, well defined, order?


    Which style has priority?
    If you're styling a box, I would do height/width first, borders, margin,
    padding, then anything that goes inside the box.
    Stuff like position should be first.

    As for naming, avoid using names that might clash with tag names.
    body2 might be confused with body. So add something to the beginning so the
    browser knows it's not a tag. Such as BoxBody.
    richard, Sep 23, 2009
    #3
  4. David Segall

    Roy A. Guest

    On Sep 23, 4:06 pm, richard <> wrote:
    > On Wed, 23 Sep 2009 13:10:43 GMT,DavidSegall wrote:
    > > I have (almost) decided to arrange my style sheets in alphabetical
    > > order. It seems to work reasonably well for properties although I
    > > would prefer it if bounding box properties like margin and border were
    > > together.

    >
    > > I am prepared to name classes so that similar classes are collected.
    > > So, for example, imageLeft and imageRight are clumsier than leftImage
    > > and rightImage but I can live with it.

    >
    > > Can someone suggest a superior, well defined, order?

    >
    > Which style has priority?
    > If you're styling a box, I would do height/width first, borders, margin,
    > padding, then anything that goes inside the box.
    > Stuff like position should be first.
    >
    > As for naming, avoid using names that might clash with tag names.
    > body2 might be confused with body. So add something to the beginning so the
    > browser knows it's not a tag.


    I will suggest you add something '.' or '#' e.g. .body or #body. That
    would be less confusing. No browser that I know of would be confused
    by .body2, #body2 or .body, #body.
    Roy A., Sep 24, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bugbear
    Replies:
    8
    Views:
    375
    Roedy Green
    Jul 20, 2005
  2. Replies:
    0
    Views:
    510
  3. Mick Charles Beaver

    pylint style convention

    Mick Charles Beaver, Jul 24, 2007, in forum: Python
    Replies:
    2
    Views:
    331
    Ben Finney
    Jul 24, 2007
  4. Stefan Ram

    Re: style guide on method ordering

    Stefan Ram, May 16, 2008, in forum: Java
    Replies:
    1
    Views:
    357
    Stefan Ram
    May 16, 2008
  5. nbigaouette

    Z-Ordering (Morton ordering) question

    nbigaouette, Nov 5, 2009, in forum: C Programming
    Replies:
    2
    Views:
    2,098
Loading...

Share This Page