Results 1 to 6 of 6

Thread: Assigning CSS to a page

  1. #1
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Assigning CSS to a page

    Code:
    <style type="text/css">
     @import style.css";
    </style>
    Is the only importance of an @import function compared to <link rel="StyleSheet"> is that it does not "save" the CSS stylesheet when we "Save As" a webpage?

    Or is there a different reason?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I've never seen that before. Not sure about it, but I'd suggest not using that... use the more usual style, just to ensure compatibility...
    That may be fine though.... but since I haven't seen it, I'm just guessing it isn't a standard option... or at least might not be.

    As for your question, I would assume so. Also, different browsers would handle the "saving" differently, so keep that in mind too.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    you can import it within a css file.

  4. #4
    Join Date
    Apr 2006
    Location
    London
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    I've never seen that before.
    http://www.w3.org/TR/REC-CSS2/cascade.html#at-import



    Quote Originally Posted by djr33 View Post
    just to ensure compatibility...
    http://imfo.ru/csstest/css_hacks/import.php

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by VatsaL View Post
    Is the only importance of an @import function compared to <link rel="StyleSheet"> is that it does not "save" the CSS stylesheet when we "Save As" a webpage?
    No, not in the least. They have completely different purposes. The former essentially means that a style sheet requires or uses rules from another style sheet. For example, one might choose to separate rules such that one style sheet contains simple, common rules that apply to all documents in a site, and those style sheets that include it then build upon those rules, refining them for a particular layout. Whilst one could use multiple link elements to do the same thing, there really is no need (and it requires more bytes to do the same job).

    If a user agent doesn't save an imported style sheet, that is a peculiarity of that program. All a user agent need do is examine the beginning of a style sheet for any import rules, and add them to its list of resources to save.


    Quote Originally Posted by djr33 View Post
    ... I'm just guessing it isn't a standard option ...
    It was specified in the first version of CSS and in every version since; it's been supported for years.

    Mike
    Last edited by mwinter; 11-19-2006 at 02:55 PM.

  6. #6
    Join Date
    Nov 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @import does not support the media type in IE6 directly. But that's no reason not to use it, as you can assign media-type in the style tag.

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
  •