Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    my inner divs arent inheriting the background colour of my wrapper divs

    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
    Code:
    <body>
    <div class="centerbody"> // my wrapper div
    /// rest of site
    </div>
    </body>
    I have css for the body and for the wrapper:

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

    Code:
    .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)
    Find tutors in the uk
    know your tenants rights

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    background is not an inheritable property.
    But, in your case, you need to clear the floats to stretch the container till the end of inner elements. Set overflow:auto; to .centerbody
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •