SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    embbebed or link css

    Hello.



    What's the main difference between importing CSS or linking it?

    The size of the html page?

    Thank you.

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what do you mean by embedded? just placing it in <style>-tags or using the @import feature?

    myself I prefer using the @import feature, for example:
    Code:
      <style type="text/css">
        <!--
        @import url(./inc/stylesheet.css);
        -->
      </style>
    I've heard this should work better than using a <link>-tag in some cases...

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2001
    Location
    earth
    Posts
    501
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes! Embebbed is:
    Code:
    @import url(./inc/stylesheet.css);
    But I always used the a link to external css.
    And I would like to know which should use and why?
    [img]images/smilies/smile.gif[/img]

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    Plant City, FL
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The link is supported by all browsers, whereas import isn't. Importing it and leaving out link means your stylings can be only viewed by browsers with CSS support. Browsers that won't see it are:

    * Netscape 4.x
    * Win IE 3
    * Win IE 4 (not 4.72)
    * Mac IE 4.01
    * Mac IE 4.5
    * Konqueror 2.1.2
    * Win Amaya 5.1

    Using both ensures everyone can view your webpage, though it may not look right if CSS isn't supported.

    Linking to an external .css file allows the browser to cache it, so other pages can use it without having to load it everytime.
    Matt Burris
    Good Blimey! - My personal blog.
    MattPlays - High-quality, streaming gameplay videos.

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Actually, IE4 can read @import unfortunately

  6. #6
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So what are the benefits of @import over link? The fact that old browsers won't screw up your css?

  7. #7
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by tempus
    So what are the benefits of @import over link? The fact that old browsers won't screw up your css?
    @import was meant to easily include other stylesheets from within a CSS file. Think of it as SSI or php's include() function, but for CSS files. It also has the added benefit of being hidden from Netscape 4.

  8. #8
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone have any other information of links about the benefits of one over the other?

  9. #9
    Ceci n'est pas Zoef Zoef's Avatar
    Join Date
    Nov 2002
    Location
    Malta
    Posts
    1,111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like Vinnie said.

    A frequently used trick is to link to a 'simple' stylesheet for NN4 and import the 'full' stylesheet for newer browsers.

    Rik
    English tea - Italian coffee - Maltese wine - Belgian beer - French Cognac

  10. #10
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but what about the problem of browsers not caching imported CSS files?


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
  •