I have the following HTML and CSS that behaves totally different in Firefox and Chrome.
JSFiddle.
.container {
width: 200px;
height: 50px;
border: 1px solid black;
display: inline-table;
}
.content {
background-color: red;
width: 30%;
height: 100%;
}
<div class="container">
<div class="content"></div>
</div>
<div class="container">
<div class="content"></div>
</div>
In Chrome it displays correctly but not in Firefox.
Chrome:
Firefox:
By inspecting the content div in Firefox, the height is 0.
Why does it work in Chrome and Safari, but not in Firefox?
I notice that removing the display: inline-table
will work but the container div will be stacked instead of inline.
height:100vh box class has only 100vh which is 100% of the viewport height. When you set the height to 100vh, the box element will stretch its height to the full height of the viewport regardless of its parent height.
For years, the answer was the following: html { height: 100%; } body { min-height: 100%; } This allows the HTML element to reference the parent viewport and have a height value equal to 100% of the viewport value.
Try changing display: inline-table;
to display: inline-block;
.
http://jsfiddle.net/yAa3y/12/
I could only get it to work when I used
.content {
display: inline-table;
}
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