Including one stylesheet inside another

Discussion in 'HTML' started by Chris, Feb 1, 2008.

  1. Chris

    Chris Guest

    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?
     
    Chris, Feb 1, 2008
    #1
    1. Advertising

  2. Chris

    Els Guest

    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/
     
    Els, Feb 1, 2008
    #2
    1. Advertising

  3. Chris

    Els Guest

    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/
     
    Els, Feb 1, 2008
    #3
  4. Chris

    dorayme Guest

    In article <47a3a23a$0$14083$>,
    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.


    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
     
    dorayme, Feb 1, 2008
    #4
  5. Chris

    Els Guest

    dorayme wrote:

    > In article <47a3a23a$0$14083$>,
    > 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.

    >
    > 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/
     
    Els, Feb 1, 2008
    #5
  6. Chris

    Neredbojias Guest

    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.
     
    Neredbojias, Feb 2, 2008
    #6
  7. Chris

    dorayme Guest

    In article <5ooj9wq2jv9v.182bboxls048q$>,
    Els <> wrote:

    > dorayme wrote:
    >
    > > In article <47a3a23a$0$14083$>,
    > > 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.

    > >
    > > 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
     
    dorayme, Feb 2, 2008
    #7
  8. Chris

    dorayme Guest

    In article <Xns9A37B12252ECFnanopandaneredbojias@85.214.90.236>,
    Neredbojias <> 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
     
    dorayme, Feb 2, 2008
    #8
  9. Gazing into my crystal ball I observed Chris <>
    writing in news:47a3a23a$0$14083$:

    > 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
     
    Adrienne Boswell, Feb 2, 2008
    #9
  10. Chris

    Neredbojias Guest

    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.236>,
    > Neredbojias <> 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.
     
    Neredbojias, Feb 2, 2008
    #10
  11. Chris

    dorayme Guest

    In article <Xns9A38931058E17nanopandaneredbojias@85.214.90.236>,
    Neredbojias <> wrote:

    > I took the OP's meaning of "site" in "multiple sites" as "page".


    You did? (my camera-eyes go all big and wide...)

    --
    dorayme
     
    dorayme, Feb 2, 2008
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nail
    Replies:
    0
    Views:
    1,564
  2. =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=

    Stylesheet referanse i stylesheet

    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=, Jul 3, 2004, in forum: XML
    Replies:
    3
    Views:
    591
    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=
    Jul 4, 2004
  3. Steven An
    Replies:
    1
    Views:
    512
    Martin Honnen
    Nov 23, 2004
  4. David Blickstein
    Replies:
    3
    Views:
    1,054
    David Blickstein
    Aug 2, 2005
  5. David Blickstein
    Replies:
    14
    Views:
    6,381
    Harrie
    Oct 16, 2005
Loading...

Share This Page