I have created a fiddle: http://jsfiddle.net/pQZ8f/
I want to have both the list items to be of same height without setting height manually. I want it to auto grow. I don't want to use javascript. Can it done be through css?
Adding class ="frame-height" to all li elements, make all li elements the same height as the highest li element.
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.
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.
You just have to use class="row-eq-height" with your class="row" to get equal height columns for previous bootstrap versions.
It's 2018, and we have display: flex, with 97.66% browser support (https://caniuse.com/#feat=flexbox)
With flexbox, all you need to do is:
ul {
display: flex;
}
li{
width:100px;
border: 1px solid black;
}
Here's the fiddle: http://jsfiddle.net/pQZ8f/1076/
It seems you're looking for a tabular layout, so maybe the best bet would be to use a <table>
instead of floating <li>
elements.
That said, you can also specify tabular styles on your elements:
ul {
display: table-row;
}
li {
width: 100px;
border: 1px solid black;
display: table-cell;
}
This should work on most modern browsers. You will find an updated fiddle here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With