3 Replies Latest reply on Mar 9, 2010 1:54 AM by osgood_

    Divs and colours

    Jacquie2

      Can anyone enlighten me as to how I can change the background colour of a sidebar div on a single page without it also changing the colour of the sidebar on every other page? I am learnign CSS and Dreamweaver - just cant figure this one out. Any help greatly appreciated!

      Jacquie

        • 1. Re: Divs and colours
          osgood_ Level 8

          Jacquie2 wrote:

           

          Can anyone enlighten me as to how I can change the background colour of a sidebar div on a single page without it also changing the colour of the sidebar on every other page? I am learnign CSS and Dreamweaver - just cant figure this one out. Any help greatly appreciated

          Jacquie

           

           

          A couple of ways

           

          1) Add some embeded css (see below) in the head section of your page (it MUST be inserted after the link to your main css file). This will then over-ride the background-color set in your main css styles sheet

           

          <style type="text/css">

          #sidebar {

          background-color: #000;

          }

          </style>

           

          2) Add some inline css to the <div> itself (see below) on the page in which you want the background color to be different

           

          <div id="sidebar"> style="background-color: #000;">

          Some stuff

          </div>

           

          inline styling will be given preference over linked or embeded css styles.

          1 person found this helpful
          • 2. Re: Divs and colours
            Jacquie2 Level 1

            Thankyou so much!

            I will try them both out...it can be quite tricky learning this stuff on your own without a teacher!

            Very grateful...

            • 3. Re: Divs and colours
              osgood_ Level 8

              Jacquie2 wrote:

               

              Thankyou so much!

              I will try them both out...it can be quite tricky learning this stuff on your own without a teacher!

              Very grateful...

               

              You're welcome.

               

              If you try option 2 then it should be as below NOT as I first typed. I left and extra > after "sidebar" which isn't required.

               

              <div id="sidebar" style="background-color: #000;>

              Some stuff

              </div>