Linking Multiple Stylesheets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don G

    Linking Multiple Stylesheets

    Is it possible to link multiple stylesheets to a single web page? I
    have an overall stylesheet for my entire site, but there are a few pages
    with a minor differences. I originally had these as inline styles, but
    I would like to move them to external stylesheets, if possible.

    I did some Google searches, and I found links that seemed to suggest
    that multiple stylesheets could be linked to a single page, but didn't
    give the details as how to do it.

    I have tried code similar to:

    <link rel="stylesheet " type="text/css" href="general.c ss" />
    <link rel="stylesheet " type="text/css" href="specific. css" />

    But the styles of the second sheet were not applied.

    Thanks in advance,

    Don
  • Don G

    #2
    Re: Linking Multiple Stylesheets

    Nevermind... I did a little more Goolging, and I managed to find a page
    describing what needs to be done. The title attribute must be defined
    and be the same for all styles that will be used at the same time.

    <link rel="stylesheet " type="text/css" href="general.c ss" title="style1" />
    <link rel="stylesheet " type="text/css" href="specific. css" title="style1" />

    I did this on my page and it worked like a charm.

    Don

    Comment

    • Steve Pugh

      #3
      Re: Linking Multiple Stylesheets

      Don G <mail4dag@yahoo .com> wrote:
      [color=blue]
      >I have tried code similar to:
      >
      ><link rel="stylesheet " type="text/css" href="general.c ss" />
      ><link rel="stylesheet " type="text/css" href="specific. css" />
      >
      >But the styles of the second sheet were not applied.[/color]

      That will work. There must be something else going on. Post a URL.

      Steve


      --
      "My theories appal you, my heresies outrage you,
      I never answer letters and you don't like my tie." - The Doctor

      Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

      Comment

      • Vincent Poinot

        #4
        Re: Linking Multiple Stylesheets

        Don G wrote:[color=blue]
        >
        > I have tried code similar to:
        >
        > <link rel="stylesheet " type="text/css" href="general.c ss" />
        > <link rel="stylesheet " type="text/css" href="specific. css" />
        >
        > But the styles of the second sheet were not applied.[/color]

        You have to give a title to your specific stylesheet: the general one
        will contain permanent rules (rules that always apply), the one with a
        title will be your "preferred" stylesheet (as opposed to alternate
        stylesheets). So something like this should do:

        <link rel="stylesheet " type="text/css" href="general.c ss" />
        <link rel="stylesheet " type="text/css" href="specific. css"
        title="preferre d"/>


        Vincent.


        --
        Want to spend holidays in France ? Check http://www.relinquiere.com/

        Comment

        • phil_gg04@treefic.com

          #5
          Re: Linking Multiple Stylesheets

          >> <link rel="stylesheet " type="text/css" href="general.c ss" />[color=blue][color=green]
          >> <link rel="stylesheet " type="text/css" href="specific. css" />
          >> But the styles of the second sheet were not applied.[/color]
          > That will work. There must be something else going on.[/color]

          Steve, I agree with you. This should work (I do it all over the
          place). What's all this about title attributes? I thought that was
          something to do with alternate stylesheets. Don G, can you post the
          reference that convinced you that you needed a title? Is this a
          browser-specific thing?

          --Phil.

          Comment

          • Steve Pugh

            #6
            Re: Linking Multiple Stylesheets

            phil_gg04@treef ic.com wrote:
            [color=blue][color=green][color=darkred]
            >>> <link rel="stylesheet " type="text/css" href="general.c ss" />
            >>> <link rel="stylesheet " type="text/css" href="specific. css" />
            >>> But the styles of the second sheet were not applied.[/color]
            >> That will work. There must be something else going on.[/color]
            >
            >Steve, I agree with you. This should work (I do it all over the
            >place). What's all this about title attributes?[/color]

            It's a little bit complicated, see

            [color=blue]
            > I thought that was something to do with alternate stylesheets.[/color]

            Yes. Mostly.

            If the value of the rel attribute is "stylesheet " and there is no
            title then the stylesheet is persistent and will always be applied.
            There can be any number of such stylesheets.

            If the value of the rel attribute is "stylesheet " and there is a title
            then the stylesheet is preferred and will initially be applied. If
            there is more than one such stylesheet (with different titles) then
            the last specied is used and the others are ignored.

            If the value of the rel attribute is "alternate stylesheet" then the
            title attributes serves to group these styles together. So the user
            can select to apply a group of stylesheets in one go.

            Steve

            --
            "My theories appal you, my heresies outrage you,
            I never answer letters and you don't like my tie." - The Doctor

            Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

            Comment

            Working...