SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    Non-Member Silence's Avatar
    Join Date
    Oct 2001
    Location
    Michigan
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using css via a css file

    Hello, I am looking to make my new site compliant in Netscape 4.x, 6., and IE 5.5, and 6.

    My question lies in the fact that I want to use a css file instead of having css code at the top of every page. Instead would just link to the stylesheet,

    ala
    Code:
    <link rel="stylesheet" href="silence.css">
    My question is: Does netscape have trouble doing such a thing? Are there any pros/cons to doing this?

    Any insight would be appreciated.

  2. #2
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know, NS4 has no trubble using a stylesheet <link>, but can't read the @import rule of CSS2.

    There are many pros with using external files mostly revolving around consistency, code reuse, and browser cashing. However, using a sepperate file does entail another round trip to the server for the client to retrive the stylesheet. The bottom line is that you'll probily want to use a <link> if you have several pages using the same or simular stylesheets, but for just one page, it may not be worth it.

    If you do use <link>s than you must include a type attribute in the <link>: in your case 'type="text/css"'. Oh and also, you can use the <link> eliment to bring in a standard stylesheet and use the <style> to modify it for the particular page.

    ~~Hope This Helps

  3. #3
    SitePoint Addict five40's Avatar
    Join Date
    Jul 2001
    Location
    Imatra, Finland
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the way I do it (works with Netscape also).

    Including the css-file has the advantage that changing only one file (maybe even one line) can change the style in the rest of the css-linked pages.
    "-Surely you can't be serious ?
    -Yes I am serious...and don't call me Shirley."

  4. #4
    Non-Member Silence's Avatar
    Join Date
    Oct 2001
    Location
    Michigan
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool. Sounds like it is the direction I want to head in. Thanks guys!

  5. #5
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Silence,

    You might want to also check out the master class on this site as it goes into how you can get your pages to work in all browsers, what works what doesn't, best layout all for css... worth a read honest

    www.richinstyle.com

    Sarah
    Regular user

  6. #6
    Non-Member Silence's Avatar
    Join Date
    Oct 2001
    Location
    Michigan
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Sarah. I will check that out right now before I head to bed.

  7. #7
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I would advise reading it with a clear head otherwise you'll think its all gone mad

    (in all fairness Creole pointed it out to me and well I have been advertising it ever since )
    Regular user

  8. #8
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just passed it on myself. I can't remember who first gave that link to me. One thing I will point out though that I don't like about the RichInStyle "template stylesheet" is the fact that they use em as their unit of measurement.

    em cascades through the stylesheet which means that child elements will inherit the defult style of the parent and then apply their own style. This means that if I set BODY and P to .9em the BODY text will be the proper size but the P tag will be .8em (or whatever the math would be) because it first uses the parent elements style (.9em) and bases it's size from that.

    This is only a problem with the em unit of measurement.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  9. #9
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I know what you mean - but then the whole font stuff did my head in a bit, I stick to what I knwo works and that will do me fine.

    Also you know the "standard" css sheet why does he use the UL LI OL all the way across?
    Regular user

  10. #10
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do you have php? You can serve up links to browser specific .css files if you do, or even include them on the page (bypassing any <link> issues). Alternatively, use simple css that won't choke ns4x with the <link> way and any fancy stuff for NS6-IE5+ with the @IMPORT way - that way you can get good performance across browsers.

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS


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
  •