Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Stylesheets with <meta> or @import ?

    Hello all

    I was looking through some html today, and ran into
    Code:
    <style type="text/css" media="all">@import "/styles.css";</style>
    which got me thinking... I myself always use
    Code:
    <link rel="stylesheet" type="text/css" href="comic.css" />
    Which of these is preferable to use, and why?

    Thanks!

  • #2
    Senior Coder
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    2,469
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the import method can be useful if you want to import multiple style sheets into one section... but most importantly, importing hides styles from older browsers -- the link tag does not. I prefer the links myself, just because it isn't as fickle for me right now and it looks cleaner to me because I'm anal about how code looks (you can do multiple ways of importing that some browsers will not read, which can be useful, read below), and you can also import into a linked external file... meaning, you make your external CSS file, and link it to your document (the meta way) but in that file put an import -- this is a trick some designers use so they can still use the link tag for javascript style switchers, but still hide the junk from old browsers, take a look at simplebits.com's file:
    simplebits css
    simplebits home (look at his home page code, you can link alternate styles as well)

    And here's a bit about import options and what browsers read what:
    http://w3development.de/css/hide_css...owsers/import/

    This is my take on it, some other users will have some better ideas
    Last edited by bradyj; 09-21-2004 at 08:31 PM.
    // Art is what you can get away with. <-- Andy Warhol
    ...:.:::: bradyjfrey.com : htmldog : ::::.:...

  • #3
    New Coder
    Join Date
    Apr 2003
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok thanks!

    I'll stick to the link method for now.. Looks better

  • #4
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bradyj
    but most importantly, importing hides styles from older browsers -- the link tag does not.
    Not quite...
    The link stylesheet won't be used by NN4.7 unless the media attribute is set as "all". Since there is almost never a reason to use media="all" it's quite simple to hide it from nn4.7.
    Designing for the screen? use media="screen, projection" (projection is for Opera's full screen mode - thanks brothercake )
    Designing for print? use media="print"
    Handheld? media="handheld"

    ... there would be very few cases when you would want the same CSS file used for all these media.

    I take no responsibility for the above nonsense.


    Left Justified

  • #5
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'd use <link media="all" /> for my styles that are renderable by even the baddest of browsers, and then @import "style.css" for my styles that are meant for more capable browsers (IE5+, Moz)

  • #6
    Regular Coder
    Join Date
    Jul 2004
    Location
    France
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but who care for NN4.7 ????

  • #7
    Senior Coder
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    2,469
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gwendaal
    but who care for NN4.7 ????
    I don't, I don't even code for it anymore -- but sometimes I just like to hide it from older browsers so they just get a simple text version, that's all. I see NN4 just like a screenreader or a handheld -- they get all my information, it just isn't styled like the advanced browsers.
    // Art is what you can get away with. <-- Andy Warhol
    ...:.:::: bradyjfrey.com : htmldog : ::::.:...

  • #8
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bradyj
    I see NN4 just like a screenreader or a handheld -- they get all my information, it just isn't styled like the advanced browsers.
    I'd like to do the same for IE/mac, it's just too much of a pain to filter it properly

    I take no responsibility for the above nonsense.


    Left Justified

  • #9
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @import "style.css" hides from IE/Mac 4.01 or something like that, according to that link Brady posted. I've not had any problems on IE5 for the Mac... It's better than the Windows version is it not?

  • #10
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by AaronW
    @import "style.css" hides from IE/Mac 4.01
    ie4?! Who cares about ie4??
    Quote Originally Posted by AaronW
    It's better than the Windows version is it not?
    You've got me there - the rendering engine (trident?) was the top of it's time... I'm biased against it though - I've never had enough time to test bugs properly on it and the fact that it has a very different bug set than the windows version makes me want to put it in the NN4.7 bin. Brady insisting that no one uses it anymore isn't tempting me to stop ignoring it either

    I take no responsibility for the above nonsense.


    Left Justified

  • #11
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The rendering engine is called Tasman.

  • #12
    Senior Coder
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    2,469
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mindlessLemming
    Brady insisting that no one uses it anymore isn't tempting me to stop ignoring it either
    You're only hurting yourself, just let it go...
    // Art is what you can get away with. <-- Andy Warhol
    ...:.:::: bradyjfrey.com : htmldog : ::::.:...

  • #13
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    You might as well use Lynx


  •  

    Posting Permissions

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