Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI tabs: how to place div with float:left property into tab?

I use jQuery UI 1.8.16 for tabs. I want to place in first tab few divs as columns (with float:left property).

But I can't do it correctly: looks like tabs don't want to work with float property in proper way (see image under the text).

There is code:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">First</a></li>
        <li><a href="#tabs-2">Second</a></li>
        <li><a href="#tabs-3">Third</a></li>
    </ul>
        <div id="tabs-1">
                <div style="border:1px solid red;float:left;">
                    some text<br>some text<br>some text<br>some text<br>some text<br>some text<br>some text<br>some text<br>
                </div>
        </div>
        <div id="tabs-2"></div>
        <div id="tabs-3"></div>

</div>

How to fix that?

Thanks!

enter image description here

like image 650
Vitalii Ponomar Avatar asked Nov 28 '11 10:11

Vitalii Ponomar


1 Answers

You have to clear your floats in order for the container to compute the proper height:

<div id="tabs-1">
    <div style="border: 1px solid red; float: left;">
        some text<br>some text<br>some text<br>some text<br>some text<br>some text<br>some text<br>some text<br>
    </div>
    <div style="clear: both;"></div>
</div>

You can see the results in this fiddle.

like image 128
Frédéric Hamidi Avatar answered Oct 30 '22 10:10

Frédéric Hamidi