g at risky-biz.com wrote in message news:1127935385.754379.223000@z14g2000cwz.googlegroups.com...
>g at risky-biz.com wrote in message news:1127935385.754379.223000@z14g2000cwz.googlegroups.com...
>> I'd like to have a CSS file for everything that's common to my site,
[quoted text clipped - 16 lines]
>
>http://www.w3.org/TR/REC-CSS2/cascade.html#at-import
Thank you. Here's why I want to do this.
I have a number of photo gallery pages that will have the same overall
look, but a different background image for the TOC area and possibly
some other slight changes. I started out doing this by copying the CSS
file, making the changes, and giving it a new name. But I realized
that should I want to do something global, change the background from
black to white for example, I'd have to do that on a bunch of
different files.
Following your advice I will soon make up a stylesheet that has all
the common elements and several others with the variable stuff.
Greg Guarino
Robi - 30 Sep 2005 05:02 GMT
>> g at risky-biz.com wrote in message news:1127935385.754379.223000@z14g2000cwz.googlegroups.com...
>>> I'd like to have a CSS file for everything that's common to my site,
[quoted text clipped - 18 lines]
>>
> Thank you. Here's why I want to do this.
you're welcome
> I have a number of photo gallery pages that will have the same overall
> look, but a different background image for the TOC area and possibly
[quoted text clipped - 6 lines]
> Following your advice I will soon make up a stylesheet that has all
> the common elements and several others with the variable stuff.
I don't know exactly how the '@import' rule behaves with relative urls
Let's say yor page is located in /www/root/galleria
(galleria has a subdirectory css -> /www/root/galleria/css)
the global.css is located in /www/root/css
if you have other pages in other directories i.e.
/www/root/gallerib (including subdirectory css)
/www/root/galleric (the css subdirectories are not necessary, but they
give a clean slate and order ;-)
Now for all galleria pages you have a specific style that differs from
the global.css. let's call it common.css and place it in the subdirectory
/www/root/galleria/css
now you can have the following lines in your html page:
<link rel="stylesheet" type="text/css" href="/css/global.css">
<link rel="stylesheet" type="text/css" href="css/common.css">
note the difference in the hrefs (one is "absolute" and one is "relative")
I somehow think that the same is possible with the '@import' rule
where you would only need the global.css link line, and in global.css
you would have the following line:
@import url(css/common.css);
but here is where I am not sure about the rule.
Wwill the browser think common.css is in /css/css/common.css
or since gallery.html is in /galleria/gallery.html by linking to the global.css
stylesheet in /css/global.css will the '@import' rule in global.css be
understood as /galleria/css/common.css
or instead, if that doesn't work
<style type="text/css">
@import url(/css/global.css);
@import url(css/common.css");
</style>
of course, you could even go further and add page specific styles
<link rel="stylesheet" type="text/css" href="/css/global.css">
<link rel="stylesheet" type="text/css" href="css/common.css">
<style type="text/css">
h1 { color: blue }
</style>
to make it a bit more complicated, add media types ;-)
http://www.meyerweb.com/eric/articles/webrev/200001.html
BTW, if you're going to have your gallery pages sent as XHTML then AFAICR
you will need to have all your tags and selectors defined in lowercase.
( http://www.w3.org/TR/REC-CSS2/selector.html#q1 second paragraph )
I am honestly very unfamiliar with the '@import' rule, and might be giving
a completely wrong advice here, so if someone else can shed some light on
anything that I have misunderstood, It would be greatly appreciated :-)