View Full Version : Assigning CSS to a page
VatsaL
11-18-2006, 03:03 AM
<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?
djr33
11-18-2006, 04:48 AM
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.
chovy
11-18-2006, 05:43 AM
you can import it within a css file.
VatsaL
11-18-2006, 06:45 PM
I've never seen that before.
http://www.w3.org/TR/REC-CSS2/cascade.html#at-import
just to ensure compatibility...
http://imfo.ru/csstest/css_hacks/import.php
mwinter
11-19-2006, 02:50 PM
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.
... 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
chovy
11-20-2006, 01:34 AM
@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.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.