CSS Import Q
- Started
- Last post
- 5 Responses
- ninjasavant
I tried doing a search on this topic but I guess I don't know how to phrase the question in a search engine.
I have a bunch of .css files for individual widgets on a web page using an ajax framework. Is it possible to have a single file that calls the styles from those css files and import that file into my web page or do I need to import all of the .css files individually?
- uan0
search for something along 'faster websites', there are some solutions around I think...i.e.:
http://rakaz.nl/item/make_your_p…
- bulletfactory0
I usually create a master.css sheet that has all of them in one file
master.css:
/* <![CDATA[ */
@import url("reset.css");
@import url("type.css");
@import url("menu.css");
/* ]]> */on your html in the head - <style type="text/css" media="Screen">
/*\*/@import url("css/master.css");/**/
</style>i'm sure this post will fail with the code....
- ninjasavant0
thanks bullet, I'm gonna try that.
- IRNlun60
There are some negatives to using @import in your HTML.
http://www.stevesouders.com/blog…
I usually do what bulletfactory mentioned above. Create a master css file and use an @import from within the css file. Although, don't use the CDATA commenting in your css. It should work as mentioned above(because it's basically commented out) but that's only for XML compatibility in XHTML.
One special commenting I'm aware of for importing in css is hiding from IE/Mac.
/* import stylesheets and hide from IE/Mac \*/
@import url("master.css");
@import url("ie7.css");
/* end import/hide */- nice link, thanks!bulletfactory
- Do you really find you need to worry about IE/Mac users?welded
- Ha, no. I can't remember the last time I tested for that. 5-8 yrs maybe...IRNlun6
- acescence0
i use a css minimizer to shrink filesize as well