Help me float left then height auto in div?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thomasbll
    New Member
    • Apr 2012
    • 1

    Help me float left then height auto in div?

    i have css:

    #tabdiv {
    margin: 10px;
    border: 1px solid #fff;
    padding: 10px;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    }
    #tabdiv .item{
    float: left;
    border: 1px solid #fff;
    padding: 10px;
    width: 200px;
    height: 100px;
    }

    and
    <div id="tabdiv">
    <div class="item">
    Item 01
    </div>
    <div class="item">
    Item 01
    </div>
    <div class="item">
    Item 01
    </div>
    </div>

    height of <div id="tabdiv"> is not auto = height <div class="item">

    Please help me fix.

    Thanks
  • Bharat383
    New Member
    • Aug 2011
    • 93

    #2
    <style type="text/css">

    #tabdiv {
    //margin: 10px;
    border: 1px solid #fff;
    padding: 0px;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    border:1px solid black;
    margin:5px;
    }
    /*.item{
    float: left;
    border: 1px solid #fff;
    padding: 0px;
    width: 200px;
    height: 100px;
    border:1px dotted black;
    margin:5px;
    }*/
    .item
    {
    border:1px dotted black;
    width:200px;
    height:120px;
    float:left;
    margin:10px;
    }
    </style>
    <div id="tabdiv">
    <div class="item">
    Item 01
    </div>
    <div class="item">
    Item 01
    </div>
    <div class="item">
    Item 01
    </div>
    <div class="item">
    Item 01
    </div>
    <div style="clear:bo th;">
    </div>


    ===> add <div style="clear:bo th;"></div> after you have completed last <div class="item"></div>.
    it will compfling all the <div class="item"></div> as floating left.

    Try it.....

    Bharat Parmar(Bharat38 3)

    Comment

    Working...