6 Replies Latest reply: Nov 3, 2014 4:27 AM by TESTotnes RSS

    CSS Updating on every page

    TESTotnes

      Hi All,

       

      I can't work this one out and it's driving me mad.

       

      Is there an easy way to stop the CSS from being linked on each page. For example on my index.html page, I have a certain layout that I wanted to copy (frames and tables etc) to an about.html. However, I don't want the font to be the same etc. Every time I make a change to the CSS on index.html, it changes the about.html CSS also. I get why this is useful, but how do I change this for individual pages? I can't work out where this option is.

       

      Can you help?

        • 1. Re: CSS Updating on every page
          MurraySummers CommunityMVP

          I have a certain layout that I wanted to copy (frames and tables etc) to an about.html.

           

          Really? Frames and tables? Can I assume that you are aware of all the reasons one would not want to use either of those antique (and actually detrimental) layout methods on any contemporary web page?

           

          To have page-specific CSS on any page, just embed a stylesheet in the head of that page (below any link to your external CSS) that contains what you want as the proper styling for that page. For example -

           

          <head>

          <title></title>

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

          <style type="text/css">

          /* this is where your page-specific styles would go */

          #yourselector {

          ...

          }

          etc.

          </style>

          </head>

          • 2. Re: CSS Updating on every page
            TESTotnes Community Member

            Not quite frames and tables - I just meant the frame as in the layout and table as in layout too! Should have just said layout...

             

            Anyway... Thank you for your answer, I'm just beginning, so this is all a learning curve. I've been changing the CSS as I go along, rather than inserting an external stylesheet, do I need to insert an external one for it to work?

             

            You may need to explain it like I'm 5 Sorry!

            • 3. Re: CSS Updating on every page
              osgood_ CommunityMVP

              As Murrays reply or you could link another style sheet, if you have more than a few css changes for a specific page:

               

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

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

              • 4. Re: CSS Updating on every page
                TESTotnes Community Member

                Perfect - now I understand.

                 

                Thanks to both of you.

                • 5. Re: CSS Updating on every page
                  osgood_ CommunityMVP

                  TESTotnes wrote:

                   

                  Not quite frames and tables - I just meant the frame as in the layout and table as in layout too! Should have just said layout...

                   

                  Anyway... Thank you for your answer, I'm just beginning, so this is all a learning curve. I've been changing the CSS as I go along, rather than inserting an external stylesheet, do I need to insert an external one for it to work?

                   

                  You may need to explain it like I'm 5 Sorry!

                   

                  If you change the css in your index.html file how does it change in the about_us.html...if you have no externally linked css file .........can't work that one out.

                   

                  If you have no linked external stylesheet and the css is embedded at the top of each page then it can't change in another page?

                  • 6. Re: CSS Updating on every page
                    TESTotnes Community Member

                    If you change the css in your index.html file how does it change in the about_us.html...if you have no externally linked css file .........can't work that one out.

                     

                    If you have no linked external stylesheet and the css is embedded at the top of each page then it can't change in another page?

                    Yeah, ignore me

                     

                    I started with a tutorial on building a basic first page and then am playing from here on in to try and get used to the way things work and I didn't realise that you create the css files with each page. I presumed you meant external as in I create it externally then import. Anyway, just ignore me until the next question i'm sure i'll have!

                     

                    Thanks again.