Page 1 of 1

@import in style.css

Posted: Tue Jan 06, 2009 12:50 pm
by yellowled
As far as I remember, this isn't new, but I just stumbled across it again.

There are different ways to include stylesheets in a template. One way is @import. One could, for instance, have a master.css with the following content:

Code: Select all

@import url(css/reset.css);
@import url(css/typo.css);
@import url(css/colors.css);
etc., you get the picture. The benefit of this is a modularized stylesheet system. Anyway, if one uses this syntax in a template's style.css, it doesn't work. Doesn't even matter how one references the stylesheet to be included in the url( ) statement - it simply doesn't work in style.css, period.

However, if one actually uses a master.css or anything else != style.css, it works just fine. As we all know, style.css is "converted" in a s9y environment - the file which is actually included eventually is serendipity.css, which is style.css plus some plugin styles.

I'm guessing @import doesn't work here because PHP/Smarty get in the way during this conversion, correct? Since @ is used for some purposes in PHP/Smarty? Now, is there any way to "mask" @import and make it work in style.css? Or do we simply have to use a different stylesheet than style.css if we want to use @ in CSS?

YL

Re: @import in style.css

Posted: Tue Jan 06, 2009 1:50 pm
by garvinhicking
Hi!

Remember that the default style.css gets loaded from the root, not the template directory.

import url(templates/blabla/bla.css)

should thus work and be the sole reason. If you get the relative dirs right, it must work.

Regards,
Garvin

Re: @import in style.css

Posted: Tue Jan 06, 2009 1:59 pm
by yellowled
garvinhicking wrote:import url(templates/blabla/bla.css)
Hmmm. That - of course - works. Even better, this:

Code: Select all

@import url({TEMPLATE_PATH}bla.css);
also works. I'm almost 100% sure I tried that before, and it didn't work then ... well, what do you know? Thanks, Garvin.

YL

Re: @import in style.css

Posted: Thu Aug 20, 2009 12:34 pm
by constancy
How do i create layouts with css in dreamweaver? Pls i'm trying to switch from using the usual table layouts for webpages to css, so how do i make the layout that will hold all my text and images in it?
___________
free matrimonial