Damien
Damien

Reputation: 333

Make a div floats regardless of its content

I have two div with float left each. When the content of the second div is too long, this div goes under the first block. http://jsfiddle.net/Xuqv4/

#one {
float : left;
}

#two {
float : left;
margin-left : 10px;
}

But what i want, is that this div remains on the right of the other, regardless of its content.

The only way i found is to fix his width, but i cant in my site. The div should occupy all the available space.

Maybe you can help me ? Many thanks :)

EDIT : The #two div has not fixed width.

Upvotes: 1

Views: 65

Answers (1)

j08691
j08691

Reputation: 207901

Instead of floating the divs, set the display to table-cell:

div {
    display:table-cell;
}

jsFiddle example

Upvotes: 3

Related Questions