I have 2 div elements side by side that are set as inline-block. They both reside within a containing div. I have set the right div to height 100% but because the height of the containing div is dynamic it won't expand. Does anyone know how to make the right hand div (coulmn) expand to the dynamic height of the containing div?
<div class="container">
<div class="left_column">Dynamic Content In Here</div>
<div class="right_column">Side bar to expand to the height of the containing div</div>
</div>
Thanks
Oliver
Inline element properties: The height of an inline element is the height of the content. The width of an inline element is the width of the content. The height and width of an inline element cannot be set in CSS. You cannot set the height and width of block-level elements in CSS.
To do this, you simply need to add display: flex to the parent container and flex-grow: 1 to the divs (as opposed to defining a width). With the flexbox styles applied, we can have three inline divs of equal width – just as we can with the inline-block solutions.
Note: An inline element does not start on a new line and only takes up as much width as necessary.
The display: inline-block Value Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block , the top and bottom margins/paddings are respected, but with display: inline they are not.
After having some issues with the same problem, the simplest solution is, in my opinion, to use table-cell
as the display property. It works perfectly fine!
I think you search something like this:
.container {
min-height: 700px;
}
.right_column {
min-height: inherit;
}
Also see this jsfiddle.
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