Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two columns equal height only css (no display: table, table-row, table-cell)

Tags:

css

height

equals

In CSS, I can do something like this: http://s1.ipicture.ru/uploads/20120612/Uk1Z8iZ1.png http://s1.ipicture.ru/uploads/20120612/Uk1Z8iZ1.png

But I've no idea how to change that to something like: http://s2.ipicture.ru/uploads/20120612/eI5sNTeu.png http://s2.ipicture.ru/uploads/20120612/eI5sNTeu.png

The height is not fixed

Please help me do it! Thank you all in advance!

like image 247
Max Popkin Avatar asked Jun 11 '12 21:06

Max Popkin


People also ask

How do I make two columns the same height in CSS?

Answer: Use the CSS3 flexbox With CSS3 flex layout model you can very easily create the equal height columns or <div> elements that are aligned side by side. Just apply the display property with the value flex on the container element and the flex property with the value 1 on child elements.

How do I keep two side by side DIV elements the same height?

The two or more different div of same height can be put side-by-side using CSS. Use CSS property to set the height and width of div and use display property to place div in side-by-side format. The used display property are listed below: display:table; This property is used for elements (div) which behaves like table.

How do you make a DIV the same height as another?

Place both DIVs into a container DIV that's set to 100% of page height and set both interior DIVS to 100%. They will fill up the container DIV and the height of both will be equal.

How do you make all your Li the same height?

Adding class ="frame-height" to all li elements, make all li elements the same height as the highest li element.


1 Answers

I use this, pure css.

The html:

<div id="container" class="holder">
    <div id="column-one" class="even-height">TEXT</div>
    <div id="column-two" class="even-height">TEXT</div>
</div>

The css:

.holder {
   overflow: hidden;
   clear:    both;
}
.holder .even-height {
   float: left;
   padding-bottom: 100000px;
   margin-bottom:  -100000px;
}
#column-one { width: 30%; }
#column-two { width: 70%; }

The columns can be any width you want actually. Anyway, super simple and cross-browser friendly.

like image 148
manonatelier Avatar answered Sep 28 '22 03:09

manonatelier