The behavior is expected if the iframe
is removed (or replaced with another HTML element).
I have the following:
.container {
display: flex;
min-height: 300px;
}
.left {
width: 500px;
border: 1px solid blue;
}
.right {
border: 1px solid red;
flex-grow: 1;
}
.right>* {
width: 100%;
height: 100%;
border: none;
}
<div class='container'>
<div class='left'>
</div>
<div class='right'>
<iframe>
</iframe>
</div>
</div>
By trying the above code, the width: 500px
does not seem to work for .left
, the width is not rendered as 500px
(we can inspect the element to know its actual width). I can however increase that value to make it expand as desired but the point here is the actual width (that we see) does not match with (likely always less than) the width we specify (500px
).
It's weird because it should work as expected and yes it does work fine if we remove the iframe
or simply replace it with another HTML element (a div
, textarea
, ...)
Here is the prepared fiddle: https://jsfiddle.net/ropf2k95/
Could you think of any possible cause for that kind of weird behavior? How could we fix it to behave usually? Please note that I prefer to use container
as a flexbox.