SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Style Sheets

  1. #1
    SitePoint Member
    Join Date
    Oct 2003
    Location
    UK
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Style Sheets

    Hi

    I am relatively new to CSS and some of the stuff I see on these forums amazes me.

    Simple question. Should style declarations be placed all in one file or should one have a file for each html file or something in between?

    Regards

  2. #2
    SitePoint Enthusiast hutchysk8er's Avatar
    Join Date
    Apr 2003
    Location
    Scotland
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all the style declarations should really be placed in one file, so the styles are cached and dont need to be loaded every time a different page of ur site is opened. But if a certain style in only used in, and only will be used in one page, id jst put it in the code.
    Hutchy

  3. #3
    Ensure you finish what you sta bronze trophy John Colby's Avatar
    Join Date
    Aug 2003
    Location
    University of Central England, U.K.
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hutchysk8er
    But if a certain style in only used in, and only will be used in one page, id jst put it in the code.
    Except that if you are using different style sheets for different purposes (aural, braile, screen, handheld etc) then putting a different media type in the top of every file is going to lead to code bloat in the XHTML file.

    My take is to load everything externally e- then when you need to modify the site you won't have to bothr about a load of incuded styles that have to be modified. The benefit will really be marginal in terms of load time but substantial in terms of maintainability.
    John
    No electrons were harmed during the creation, transmission
    or reading of this posting. However, many were excited and
    some may have enjoyed the experience.

  4. #4
    Ensure you finish what you sta bronze trophy John Colby's Avatar
    Join Date
    Aug 2003
    Location
    University of Central England, U.K.
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hutchysk8er
    But if a certain style in only used in, and only will be used in one page, id jst put it in the code.
    Except that if you are using different style sheets for different purposes (aural, braille, screen, handheld etc) then putting a different media type in the top of every file is going to lead to code bloat in the XHTML file.

    My take is to load everything externally e- then when you need to modify the site you won't have to bothr about a load of incuded styles that have to be modified. The benefit will really be marginal in terms of load time but substantial in terms of maintainability.

    And as purpleski is relatively new to CSS the complete separation of content and display will benefit in the consideration of what to change where - it will be a simpler design.
    John
    No electrons were harmed during the creation, transmission
    or reading of this posting. However, many were excited and
    some may have enjoyed the experience.

  5. #5
    SitePoint Enthusiast Noosa Life's Avatar
    Join Date
    Aug 2003
    Location
    Sunshine Coast, Queensland, Australia
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Gday purpleski,

    Well as a rule of thumb when developing with CSS I tend to break up my style sheets into Text/Links and Positioning. That way I can worry about the colours/fonts/mouseovers in one file get it right and forget it. Then work on the positioning elements separately.

    Thats the basic theory I tend to use, combined with a few comments in the CSS so that I can look back it at it a few months later and go 'Oh thats why I did that'.

    The up shot to your question after all that would be to have an external file always. You can add a particular style that will only be used once to the page directly but it would be still easier to create a new style sheet and reference a second/third/fourth sheet to the page. I have found from experience that even if you think you will only use that style on one page that you end up using it somewhere else so it may as well have an external link just in case.

    Cheers


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •