...

View Full Version : my inner divs arent inheriting the background colour of my wrapper divs



mike22
06-18-2011, 04:03 PM
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>

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;
}



.centerbody {
background:none repeat scroll 0 0 #BFBFBF;
width: 1000px;
border: 0px none; margin-left: auto; margin-right: auto;
}

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)

abduraooft
06-19-2011, 02:42 PM
background is not an inheritable property.
But, in your case, you need to clear the floats (http://www.quirksmode.org/css/clearing.html) to stretch the container till the end of inner elements. Set overflow:auto; to .centerbody



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum