www.webdeveloper.com
Results 1 to 6 of 6

Thread: Link versus import

  1. #1
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972

    Link versus import

    Is there any difference in speed or effectiveness between these two ways of using an external stylesheet?
    Code:
    <style type="text/css"><!--@import"/style.css";--></style>
    Code:
    <link href="/style.css" rel="stylesheet" type="text/css">

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    No speed difference, some filtering effect because old browsers don't understand @import so you can hide the "spiffy" stuff from them using that.

  3. #3
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    If you want to do stylesheet switching, <link> is better.

    I sometimes <link> a CSS file that @import's other CSS files to get the benefits of both.

  4. #4
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    Ray: What type of stuff would you want to hide from older browsers? I can only imagine what you'd want to hide from newer browsers (i.e. obselete hacks).

  5. #5
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    I hope you don't mind my answering for you Ray.

    In this case, he is referring to IE4 and NS4.

    They don't fully support @import, so by using it you can hide CSS code from them.

    http://www.dithered.com/css_filters/css_only/index.php

    If you saw how IE4 and NS4 completely mangled a tableless layout before the CSS was hidden from them, you would understand why we do this.

  6. #6
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    I hope you don't mind my answering for you Ray.
    Not at all.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles