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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Location
    Tampa
    Posts
    223
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Nested div not extending background of parent

    I have a container and in that container I have 3 divs, the top, mid and bottom. In the mid, I have a repeating background image and two divs in it for left and right content. The problem I am having is that the content divs body-mid-left and body-mid-right are extending, but the background image in the body-mid isn't repeating or showing. If I take the content out of the mid left and right and put it directly in the mid it works fine, but if I put it in the mid right and left, no bg image from the mid. I am not sure what I am doing wrong, but any help would be greatly appreciated.

    Code:
    #bodycontainer {
    	width: 965px;
    	margin: auto;
    }
    #body-top {
    	width: 965px;
    	height: 9px;
    	background: url(../images/bg-body-top.png) no-repeat;
    }
    #body-mid {
    	width: 965px;
    	height: auto;
    	background-image: url(../images/bg-body-mid.jpg);
    }
    #body-mid-left {
    	width: 597px;
    	float: left;
    }
    #body-mid-right {
    	width: 368px;
    	float: left;
    }
    #body-bot {
    	width: 965px;
    	height: 12px;
    	background: url(../images/bg-body-bot.png) no-repeat;
    }
    Code:
    	<div id="bodycontainer">
    		<div id="body-top">
    		</div>
    		<div id="body-mid">
    			<div id="body-mid-left">
    				<h1>Welcome to Our Practice</h1>
    			</div>
    			<div id="body-mid-right">
    				<h1>Testimonials</h1>
    			</div>
    		</div>
    		<div style="clear:both"></div>
    		<div id="body-bot">
    		</div>
    	</div>

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Location
    Tampa
    Posts
    223
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Thank you I was able to find the answer with your link. My clear needed moved up.

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello dprichard,
    It's easy to clear it without adding markup. Remove that clearing div and add this to your CSS -
    Code:
    #body-mid {
    	width: 965px;
    	height: auto;
    	background: url(../images/bg-body-mid.jpg);
    	overflow: auto;
    }
    Clearing with overflow:auto; explained here.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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