Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Including one stylesheet inside another

Reply
Thread Tools

Including one stylesheet inside another

 
 
Chris
Guest
Posts: n/a
 
      02-01-2008
I've got a puzzling problem.

We have multiple sites that use the same large css file. I just make a
copy of it for each site. For each site, though, I'd like to customize a
couple small things like link color.

I could just edit each copy of the css file, but that would make it hard
to maintain when I want a change to appear in all sites.

The ideal solution would be to use an <include> in the css file:

my-big-file.css would be:

#mystyle {
whatever:10px;
}
<include include="my-custom-css.css">

Then for each site, "my-custom-css.css" could be different.

The obvious solution here is to break it up into two different css files
and include both in every page in every site. This would affect a lot of
pages unnecessarily, though, and would be cumbersome if I ever had to
break it into 2, 3, or 4 small css files. A single include statement in
one file would be a lot cleaner.

Is there some way to do this kind of include?
 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      02-01-2008
Chris wrote:

> I've got a puzzling problem.
>
> We have multiple sites that use the same large css file. I just make a
> copy of it for each site. For each site, though, I'd like to customize a
> couple small things like link color.
>
> I could just edit each copy of the css file, but that would make it hard
> to maintain when I want a change to appear in all sites.
>
> The ideal solution would be to use an <include> in the css file:
>
> my-big-file.css would be:
>
> #mystyle {
> whatever:10px;
> }
> <include include="my-custom-css.css">


> Is there some way to do this kind of include?


@import "my-custom-css.css";

--
Els http://locusmeus.com/
 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      02-01-2008
Els wrote:

> Chris wrote:
>
>> I've got a puzzling problem.
>>
>> We have multiple sites that use the same large css file. I just make a
>> copy of it for each site. For each site, though, I'd like to customize a
>> couple small things like link color.
>>
>> I could just edit each copy of the css file, but that would make it hard
>> to maintain when I want a change to appear in all sites.
>>
>> The ideal solution would be to use an <include> in the css file:
>>
>> my-big-file.css would be:
>>
>> #mystyle {
>> whatever:10px;
>> }
>> <include include="my-custom-css.css">

>
>> Is there some way to do this kind of include?

>
> @import "my-custom-css.css";


But I'd do it the other way round.
Let each site have its own my-custom-css.css, and have an
@import "my-big-file.css";
in it.

That way you don't have to copy the big file to the different sites
when you make a change to it.

--
Els http://locusmeus.com/
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      02-01-2008
In article <47a3a23a$0$14083$(E-Mail Removed)> ,
Chris <(E-Mail Removed)> wrote:

> I've got a puzzling problem.
>
> We have multiple sites that use the same large css file. I just make a
> copy of it for each site. For each site, though, I'd like to customize a
> couple small things like link color.


Nothing easier. You link to the main one on all the sites and you
add underneath another link to another css, the second overriding
a few things you want overridden. Is there some problem you have
for this not to work?

<link rel="stylesheet" type="text/css" href="main.css">
<link rel="stylesheet" type="text/css" href="supplementary.css">

in the head of the html docs on the site where the supplementary
is appropriate.

--
dorayme
 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      02-01-2008
dorayme wrote:

> In article <47a3a23a$0$14083$(E-Mail Removed)> ,
> Chris <(E-Mail Removed)> wrote:
>
>> I've got a puzzling problem.
>>
>> We have multiple sites that use the same large css file. I just make a
>> copy of it for each site. For each site, though, I'd like to customize a
>> couple small things like link color.

>
> Nothing easier. You link to the main one on all the sites and you
> add underneath another link to another css, the second overriding
> a few things you want overridden. Is there some problem you have
> for this not to work?
>
> <link rel="stylesheet" type="text/css" href="main.css">
> <link rel="stylesheet" type="text/css" href="supplementary.css">
>
> in the head of the html docs on the site where the supplementary
> is appropriate.


From the OP:
<quote>
The obvious solution here is to break it up into two different css
files and include both in every page in every site. This would affect
a lot of pages unnecessarily, though, and would be cumbersome if I
ever had to break it into 2, 3, or 4 small css files. A single
include statement in one file would be a lot cleaner.
</quote>



--
Els http://locusmeus.com/
 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      02-02-2008
Well bust mah britches and call me cheeky, on Fri, 01 Feb 2008 23:09:36 GMT
Chris scribed:

> I've got a puzzling problem.
>
> We have multiple sites that use the same large css file. I just make a
> copy of it for each site. For each site, though, I'd like to customize a
> couple small things like link color.
>
> I could just edit each copy of the css file, but that would make it hard
> to maintain when I want a change to appear in all sites.
>
> The ideal solution would be to use an <include> in the css file:
>
> my-big-file.css would be:
>
> #mystyle {
> whatever:10px;
> }
> <include include="my-custom-css.css">


The "ideal solution" is to put a style section in each page for
customizations. Anything else is illogical.

--
Neredbojias
Riches are their own reward.
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      02-02-2008
In article <5ooj9wq2jv9v.182bboxls048q$(E-Mail Removed)>,
Els <(E-Mail Removed)> wrote:

> dorayme wrote:
>
> > In article <47a3a23a$0$14083$(E-Mail Removed)> ,
> > Chris <(E-Mail Removed)> wrote:
> >
> >> I've got a puzzling problem.
> >>
> >> We have multiple sites that use the same large css file. I just make a
> >> copy of it for each site. For each site, though, I'd like to customize a
> >> couple small things like link color.

> >
> > Nothing easier. You link to the main one on all the sites and you
> > add underneath another link to another css, the second overriding
> > a few things you want overridden. Is there some problem you have
> > for this not to work?
> >
> > <link rel="stylesheet" type="text/css" href="main.css">
> > <link rel="stylesheet" type="text/css" href="supplementary.css">
> >
> > in the head of the html docs on the site where the supplementary
> > is appropriate.

>
> From the OP:
> <quote>
> The obvious solution here is to break it up into two different css
> files and include both in every page in every site. This would affect
> a lot of pages unnecessarily, though, and would be cumbersome if I
> ever had to break it into 2, 3, or 4 small css files. A single
> include statement in one file would be a lot cleaner.
> </quote>
>
>



?

It seems obvious to me too to leave the main css file well alone,
not to touch a single hair of its poor head, not to break it up.
I happily see and agree with it being "cumbersome to break it
into 2, 3, or 4 small css files". I was suggesting no such thing.

The matter is so simple that I might well be missing something
obvious to you all? I think I am having quite a bit of trouble
lately with human communication. I might need extra terrestials
to talk to. But, alas, I am here on earth completely alone.

--
dorayme
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      02-02-2008
In article <Xns9A37B12252ECFnanopandaneredbojias@85.214.90.23 6>,
Neredbojias <(E-Mail Removed)> wrote:

> Well bust mah britches and call me cheeky, on Fri, 01 Feb 2008 23:09:36 GMT
> Chris scribed:
>
> > I've got a puzzling problem.
> >
> > We have multiple sites that use the same large css file. I just make a
> > copy of it for each site. For each site, though, I'd like to customize a
> > couple small things like link color.
> >
> > I could just edit each copy of the css file, but that would make it hard
> > to maintain when I want a change to appear in all sites.
> >
> > The ideal solution would be to use an <include> in the css file:
> >
> > my-big-file.css would be:
> >
> > #mystyle {
> > whatever:10px;
> > }
> > <include include="my-custom-css.css">

>
> The "ideal solution" is to put a style section in each page for
> customizations. Anything else is illogical.


No. If there is just one or two pages on one site that needs
something a bit different, then styles in the head to override
main *is* a reasonable thing to add (as you say). But if the
changes are to the site as a whole in some respects, then it is
not necessarily reasonable to do this on every page. But it would
be reasonable to have a supplementary sheet to link to and
especially if there are quite a few.

--
dorayme
 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      02-02-2008
Gazing into my crystal ball I observed Chris <(E-Mail Removed)>
writing in news:47a3a23a$0$14083$(E-Mail Removed) m:

> I've got a puzzling problem.
>
> We have multiple sites that use the same large css file. I just make a
> copy of it for each site. For each site, though, I'd like to customize

a
> couple small things like link color.
>
> I could just edit each copy of the css file, but that would make it

hard
> to maintain when I want a change to appear in all sites.
>
> The ideal solution would be to use an <include> in the css file:
>
> my-big-file.css would be:
>
> #mystyle {
> whatever:10px;
> }
><include include="my-custom-css.css">
>
> Then for each site, "my-custom-css.css" could be different.
>
> The obvious solution here is to break it up into two different css

files
> and include both in every page in every site. This would affect a lot

of
> pages unnecessarily, though, and would be cumbersome if I ever had to
> break it into 2, 3, or 4 small css files. A single include statement

in
> one file would be a lot cleaner.
>
> Is there some way to do this kind of include?


Separate style from color - one stylesheet that only does positioning,
etc., and another that does color. For example:

Site A:
<link type="text/css" href="style.css" rel="stylesheet">
<link type="text/css" href="style_site_a.css" rel="stylesheet>

Site B:
<link type="text/css" href="style.css" rel="stylesheet">
<link type="text/css" href="style_site_b.css" rel="stylesheet>

Etcetera, etcetera, etecetera (10 points for the source).
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      02-02-2008
Well bust mah britches and call me cheeky, on Sat, 02 Feb 2008 01:17:14
GMT dorayme scribed:

> In article <Xns9A37B12252ECFnanopandaneredbojias@85.214.90.23 6>,
> Neredbojias <(E-Mail Removed)> wrote:
>
>> Well bust mah britches and call me cheeky, on Fri, 01 Feb 2008
>> 23:09:36 GMT Chris scribed:
>>
>> > I've got a puzzling problem.
>> >
>> > We have multiple sites that use the same large css file. I just
>> > make a copy of it for each site. For each site, though, I'd like to
>> > customize a couple small things like link color.
>> >
>> > I could just edit each copy of the css file, but that would make it
>> > hard to maintain when I want a change to appear in all sites.
>> >
>> > The ideal solution would be to use an <include> in the css file:
>> >
>> > my-big-file.css would be:
>> >
>> > #mystyle {
>> > whatever:10px;
>> > }
>> > <include include="my-custom-css.css">

>>
>> The "ideal solution" is to put a style section in each page for
>> customizations. Anything else is illogical.

>
> No. If there is just one or two pages on one site that needs
> something a bit different, then styles in the head to override
> main *is* a reasonable thing to add (as you say). But if the
> changes are to the site as a whole in some respects, then it is
> not necessarily reasonable to do this on every page. But it would
> be reasonable to have a supplementary sheet to link to and
> especially if there are quite a few.


I took the OP's meaning of "site" in "multiple sites" as "page". If a
site consists of a number of pages, yes, there is a reason to make, shall
we say, a "sub-general" stylesheet. But "individual" stylesheets for
single unique pages is less efficient than including styles in the head.

--
Neredbojias
Riches are their own reward.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox and XSLT (local stylesheet works, server-based stylesheet fails) David Blickstein XML 14 10-15-2005 11:27 PM
xml:stylesheet use in document with multiple stylesheet options David Blickstein XML 3 08-02-2005 03:10 PM
have a stylesheet generate another stylesheet based on XML? Steven An XML 1 11-23-2004 01:07 PM
Access a control inside an usercontrol from another control inside another usercontrol nail ASP .Net 0 09-15-2004 03:55 PM
Stylesheet referanse i stylesheet =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?= XML 3 07-04-2004 03:16 PM



Advertisments