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 6 of 6
  1. #1
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts

    @import... any disadvantages?

    I asked this question semi-off-topic in another thread and it sort of got lost in the shuffle. I did some research and couldn't find anything. The question: Are there any disadvantages to using @import methods of linking to CSS? Besides the obvious (legacy browsers don't understand it)...

  • #2
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think Opera 7.5, in small screen rendering mode, ignores any stylesheets imported in this way. I'm not too well up on this, but I think the main problem may be that some non-conventional, but modern, user agents dont get @import.

    Kind Regards,

    Gary

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Hmm, haven't tried Opera in small screen rending mode, but I doubt that it's a problem. More likely the problem is media type related..

    One problem with @import is that iew only allows three levels of importation. Not that I think there's especially many that use more than one level in any case...
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #4
    Regular Coder
    Join Date
    Jul 2004
    Location
    mile high city
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think one advantage to referencing the .css thru the <link> element is that you can take advantage of the rel and title attributes.

    http://www.w3.org/TR/REC-html40/pres....html#h-14.3.2
    Quote Originally Posted by w3.org
    Specify that the style sheet is persistent, preferred, or alternate:
    To make a style sheet persistent, set the rel attribute to "stylesheet" and don't set the title attribute.
    To make a style sheet preferred, set the rel attribute to "stylesheet" and name the style sheet with the title attribute.
    To specify an alternate style sheet, set the rel attribute to "alternate stylesheet" and name the style sheet with the title attribute.

    http://www.w3.org/TR/REC-html40/stru...tml#linksandss
    Quote Originally Posted by w3.org
    When the LINK element links an external style sheet to a document, the type attribute specifies the style sheet language and the media attribute specifies the intended rendering medium or media. User agents may save time by retrieving from the network only those style sheets that apply to the current device.
    Computer, kill Flanders... Did I hear my name? My ears are burning...
    Good start. Now finish the job.

  • #5
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you wanted opera to use your stylesheet in SSR mode, you would declare it like so:
    Code:
    <style type="text/css" media="screen,handheld">
    @import...
    </style>
    The main problem with @import is that it suffers from flash of unstyled content.

    I take no responsibility for the above nonsense.


    Left Justified

  • #6
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Thanks for the tips guys... good point about the "rel" and "title" attributes.
    Last edited by rmedek; 02-19-2005 at 09:56 AM.


  •  

    Posting Permissions

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