Results 1 to 3 of 3

Thread: Div not extending with content

  1. #1
    Join Date
    Nov 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Div not extending with content

    I cannot get one of my divs to expand vertically with content, the content just overflows.

    My layout has a left-floated sidebar div and a right-floated content div, followed by a footer. The content div expands downwards perfectly when there is a lot of text inside it. However if the content div has less text/images than the sidebar div, the footer starts at the end of the content div, causing the text/images of the sidebar to overflow.

    This can be seen on the page here:
    http://victoriacooper.co.uk/draft2/link2.html

    The other pages just have filler text, but if you click around you'll see how it's supposed to look.

    I've tried setting the min-height of the sidebar, tried going through overflow options and browed the forums but to no avail.

    Any help would be appreciated.

    Thanks, Ally

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    if you are using floats to place the main content and side bar add the following css style to your "footer" section

    Code:
    div#footer {
         clear:both;
    }

  3. #3
    Join Date
    Nov 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I've tried that too, I'll include the relevant code, hopefully it'll make answering easier

    Code:
    #sidebar {
    	width: 150px;
    	float: left;
    	margin: 5px 0px 10px 10px;
    	padding-top: 50px;
    	text-align: center;
    }
    #content {
    	width: 700px;
    	float: right;
    	margin: 5px 15px 10px 0px;
    	padding-top: 20px;
    	padding-bottom: 20px;
    	background-image: url(images/watermark.bmp);
    	background-repeat: no-repeat;
    	background-position: center;
    }
    #footer {
    	clear: both;
    	width: 880px;
    	margin: 0px;
    	padding: 10px;
    	text-align: center;
    	border-top: 1px dotted #cccccc;

    And here's how it's used in HTML:

    HTML Code:
    <div id="sidebar">
    <p>Sidebar Stuff Here</p>
    </div>
    <div id="content">
    <p>
    Content Here
    </p>
    <div id="footer">

Bookmarks

Posting Permissions

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