single or multiple CSS files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carolyn Marenger

    single or multiple CSS files

    Hey everyone, I am looking for your thoughts and opinions.

    Is it preferable to have one css file containing all the style information
    or break it up into multiple imported files for different types of
    formatting. For example, one file for page layout related items and
    another for text formattion?

    I have seen different combinations on different pages, and am wondering
    which people find is easier to maintain. Being from a coding background
    myself, I like to keep related things together, and move the rest to a
    different file, or files. Also being from a coding background, I'd prefer
    to learn by reading about others mistakes than duplicating them myself.

    Thanks, Carolyn
  • Lauri Raittila

    #2
    Re: single or multiple CSS files

    in comp.infosystem s.www.authoring.stylesheets, Carolyn Marenger wrote:[color=blue]
    > Hey everyone, I am looking for your thoughts and opinions.
    >
    > Is it preferable to have one css file containing all the style information
    > or break it up into multiple imported files for different types of
    > formatting. For example, one file for page layout related items and
    > another for text formattion?[/color]

    Usually, it makaes sence to have everything in one file, and maybe
    supporting stylesheets for stuff that is only used on subset. If you have
    lots of stuff in these files for different media, split styleshet to
    media specific ones.

    It makes no sence to use many stylesheets for every page if they are
    always same, as it will end up more likely FOUC, as one of the files is
    bound to be delayed. Especially if your server is not that fast, and
    other end has suboptimal network preferences. Same if you have import
    rule in your external stylesheet...
    [color=blue]
    > I have seen different combinations on different pages, and am wondering
    > which people find is easier to maintain. Being from a coding background
    > myself, I like to keep related things together, and move the rest to a
    > different file, or files. Also being from a coding background, I'd prefer
    > to learn by reading about others mistakes than duplicating them myself.[/color]

    You may do that as well, just compine the small sheets on one file before
    serving them up.

    --
    Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
    Utrecht, NL.

    Comment

    • Carolyn Marenger

      #3
      Re: single or multiple CSS files

      On Thu, 03 Mar 2005 22:02:39 +0100, Lauri Raittila wrote:
      [color=blue]
      > in comp.infosystem s.www.authoring.stylesheets, Carolyn Marenger wrote:[color=green]
      >> Hey everyone, I am looking for your thoughts and opinions.
      >>
      >> Is it preferable to have one css file containing all the style information
      >> or break it up into multiple imported files for different types of
      >> formatting. For example, one file for page layout related items and
      >> another for text formattion?[/color]
      >
      > Usually, it makaes sence to have everything in one file, and maybe
      > supporting stylesheets for stuff that is only used on subset. If you have
      > lots of stuff in these files for different media, split styleshet to
      > media specific ones.
      >
      > It makes no sence to use many stylesheets for every page if they are
      > always same, as it will end up more likely FOUC, as one of the files is
      > bound to be delayed. Especially if your server is not that fast, and
      > other end has suboptimal network preferences. Same if you have import
      > rule in your external stylesheet...[/color]

      My thoughts were along the lines of one style sheet containing layout and
      positioning and a second containing styles and colours. The idea being
      that some pages on the site will look best in a multi-column format,
      others, like a gallery might need a different layout. I would however
      want the same style and colours throughout the site.

      I like your point on one file coming in quickly and another slowly, and
      screwing up the layout in the meantime. To extend on it, each file that
      gets sent needs it's own handshaking overhead. That impacts directly on
      the download speed to anyone, with a more noticeable effect on slower
      connections. The other thing is the use of additional server resources to
      deal with the additional file request.

      From a purely technical side of things, minimizing the number of files,
      speeds up transmission and reduces server resource usage. Two very good
      things.

      I suppose I could have two or three document layouts within a single
      stylesheet, just have to ensure that they are well documented, so I know
      what's going on the next day I open the file.

      Thanks for you input. I think I have reached my decision... at least for
      now. :)

      Carolyn

      Comment

      • Jim Moe

        #4
        Re: single or multiple CSS files

        Carolyn Marenger wrote:[color=blue]
        > Hey everyone, I am looking for your thoughts and opinions.
        >
        > Is it preferable to have one css file containing all the style information
        > or break it up into multiple imported files for different types of
        > formatting. For example, one file for page layout related items and
        > another for text formattion?
        >[/color]
        I use one file for the basic layout, the styles that are common to the
        site as a whole. There a separate CSS files for some pages that have
        special requirements that are not needed anywhere else, or are used only
        in a few other places.
        Having the multiple, smaller files keeps the size of the main CSS file
        manageable.

        --
        jmm dash list (at) sohnen-moe (dot) com
        (Remove .AXSPAMGN for email)

        Comment

        • Ståle Sæbøe

          #5
          Re: single or multiple CSS files

          I do this as well. One main css and if I need to tweak the style on a
          subsection, I import the main and define the new styles in a new sheets.

          In addition, when I develope I usually import a "reset sheet" to the
          main. Basically this is a sheet which strips the default styles and
          looks something like this:

          body, h1, h2, h3, h4, h5, h6, p, em, a, a:hover, a:link, a:visited,
          a:hover, div, table, td, tr, ul, ol, li, img {
          background: transparent;
          border: none;
          border-style: none;
          border-width: 0px 0px 0px 0px;
          color: #000000;
          font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
          font-size: 9pt;
          font-style: normal;
          font-weight: normal;
          margin: 0px 0px 0px 0px;
          padding: 0px 0px 0px 0px;
          text-align: left;
          text-decoration: none;
          list-style: none inside none;
          }

          This gives you a clean slate to work on :)

          Jim Moe wrote:[color=blue]
          > Carolyn Marenger wrote:
          >[color=green]
          >> Hey everyone, I am looking for your thoughts and opinions.
          >>
          >> Is it preferable to have one css file containing all the style
          >> information
          >> or break it up into multiple imported files for different types of
          >> formatting. For example, one file for page layout related items and
          >> another for text formattion?
          >>[/color]
          > I use one file for the basic layout, the styles that are common to the
          > site as a whole. There a separate CSS files for some pages that have
          > special requirements that are not needed anywhere else, or are used only
          > in a few other places.
          > Having the multiple, smaller files keeps the size of the main CSS file
          > manageable.
          >[/color]

          Comment

          Working...