Results 1 to 2 of 2

Thread: auto div heights

  1. #1
    Join Date
    Feb 2010
    Posts
    5

    auto div heights

    Hi,

    I need to design where div column adjusts its height with another div.
    the design expected:- where left and right sidebar should adjust their height to contents height.


    the code


    <div id="container2">
    <div id="vmenu">
    <p>Content for id "vmenu" Goes Here</p>
    </div>
    <div id="loginmenu">
    <?php include("login.php"); ?>
    </div>
    <div id="content">
    <p>Content for id "content" Goes Here</p>
    </div>
    </div>


    .css code

    #container2 {
    background-color: #FFF;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #999;
    border-right-color: #999;
    border-bottom-color: #999;
    border-left-color: #999;
    margin-top: -1px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    white-space: normal;
    height: auto;
    width: 942px;
    display: block;
    overflow: auto;
    }
    #vmenu {
    width: 130px;
    margin-right: auto;
    margin-left: auto;
    background-color: #FFF;
    padding: 10px;
    height:auto;
    display: block;
    }
    #loginmenu {
    width: 180px;
    margin-right: auto;
    margin-left: auto;
    background-color: #cccccc;
    padding: 10px;
    height:auto;
    }



    ......
    vmenu - left sidebar
    loginmenu - right sidebar

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    Items 17, 18 and 19 here
    http://www.wickham43.net/firefoxbackground.php
    show different methods.

    If you have a containing div with a fixed width, the background image method in item 18 is fairly easy. The other methods involve complicated nesting of divs or extra divs with position: absolute behind the divs with content.
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. div width auto not working in FF only in IE
    By FoxRocks in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 03 Jan 2009, 04:39 PM

Posting Permissions

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