1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Style sheet efficiency

Discussion in 'HTML & Website Design' started by ziandra, Jan 31, 2005.

?

How do you attach your style sheets?

  1. Attach the style sheet as an external reference

    11 vote(s)
    91.7%
  2. Server side include the style sheet

    1 vote(s)
    8.3%
  1. #1
    How do most people handle their style sheets? Do you reference them as an external file or do you include them in every page?

    I have template files that I include with php at various places in each page. My preamble used to contain

    <link type="text/css" rel="stylesheet" href="style.css">

    in the header section until I noticed that most of the hits to my site were for my style sheet. I then changed it to

    <style type="text/css">
    <?include $_SERVER['DOCUMENT_ROOT'] . "/style.css" ?>
    </style>

    in the body section.

    Both validate according to the w3 css validator and both appear the same in msie and opera.

    My guess is that my server can do the server side include of the style sheet much faster than the client can turn around and request it. This is likely to have a small amount of bandwidth reduction but more importantly a performance improvement.

    What do the rest of you do? Do server side merge your style sheet or do you have the client request it?
     
    ziandra, Jan 31, 2005 IP
  2. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Welcome to the forum :)

    I just let the file be called by the client and it does the trick just fine and dandy for me :)
     
    SEbasic, Jan 31, 2005 IP
  3. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #3
    I use external style sheets using this code:
    <link type="text/css" rel="stylesheet" href="style.css">

    But your idea does sound interesting. I might have to look into that. Thanks for the idea.
     
    ResaleBroker, Jan 31, 2005 IP
  4. fsolm1

    fsolm1 Member

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    <link href="/stylesheet.css" rel="stylesheet" type="text/css">

    This works for me fine.
     
    fsolm1, Jan 31, 2005 IP
  5. HHI Golf Guy

    HHI Golf Guy Guest

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <script type="text/javascript"></script>
    <style type="text/css" title="currentStyle">
    @import "main1.css";
    </style>

    The empty javascript to correct the unsightly Flash of Unstyled Content - most of our sites are pure CSS designs ( base layout of 2 or 3 columns with header and footer, no tables).
     
    HHI Golf Guy, Jan 31, 2005 IP
  6. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #6
    External CSS files can be cached by proxies and browsers, reducing your bandwidth use. On top of this external stylesheets often result in faster rendering because browsers don't have to parse styles again and again.

    J.D.
     
    J.D., Jan 31, 2005 IP
  7. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #7
    CSS design is goooooood.... :)
     
    SEbasic, Jan 31, 2005 IP
  8. skattabrain

    skattabrain Peon

    Messages:
    628
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #8
    JD nailed it ... including it in your actual HTML is counter-productive. if you had those 1-page sites, like those 1 page "sales" pages, then it's effective ... otherwise ... it will save your users download time AND .... very important... searcg engines will be closer to your content ... less muck to wade through (especially with G's file size limits)
     
    skattabrain, Jan 31, 2005 IP
  9. relaxzoolander

    relaxzoolander Peon

    Messages:
    141
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #9
    i voted...
    ....sounds like we have a winner.

    :)
     
    relaxzoolander, Jan 31, 2005 IP
  10. david_sakh

    david_sakh Peon

    Messages:
    1,225
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I suppose SSI could be useful if you have vastly-different sections of the site and want to save band by coding a seperate style sheet for each...
     
    david_sakh, Feb 2, 2005 IP