child divs dont seem to be inheriting parent divs background colour

Discussion in 'CSS' started by Mike224, Jun 18, 2011.

  1. #1
    I'm not sure why, but my inner divs arent inheriting the background colour of my wrapper divs


    The basic design of the site is
    
    <body>
    <div class="centerbody"> // my wrapper div
    /// rest of site
    </div>
    </body>
    Code (markup):
    I have css for the body and for the wrapper:

     body {
    	background:none repeat scroll 0 0 #EFEFEF;	
    	font-family:Verdana,Arial,Sans-Serif;
    	font-size:13px;line-height:1.4;	
     	}
    Code (markup):

    .centerbody {
    	background:none repeat scroll 0 0 #BFBFBF;
    	width: 1000px; 
    	border: 0px none; margin-left: auto; margin-right: auto;
    	}
    Code (markup):
    I've also tried using an id of centerbody, and defining #centerbody in the css, this didnt work

    I've also tried using background-color: #BFBFBF; (for centerbody) and this didnt work

    I just cant figure out why the child divs are only inheriting the body background, but not the parent div centerbody background, any ideas?
    - and if I delete the body class, the child divs dont inherit any background colour at all

    (example here: rightsfortenants.co.uk)
     
    Mike224, Jun 18, 2011 IP
  2. Trix

    Trix Peon

    Messages:
    192
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Clear the float by adding the below line to the last of "bodywrapul" div

    <div style="clear:both"></div>
     
    Trix, Jun 19, 2011 IP
  3. jcyber

    jcyber Active Member

    Messages:
    892
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #3
    problem solve :p
     
    jcyber, Jul 2, 2011 IP