The iframe
in the following demo is a flex item:
* {
margin: 0;
border: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
display: flex;
}
iframe {
background: olive;
flex: 1;
}
<iframe></iframe>
But it doesn't cover the flex container:
If you replace iframe
with a div
, it works with no problem.
- Why is that?
- What's the right approach to resolve the issue?
There does appear to be an interop issue between Microsoft Edge, and Chrome/Firefox. I'll file a bug on this immediately after answering this question, and have the team investigate further.
My immediate suggestion would be to add a
<div>
around the<iframe>
, flex that<div>
, and then set thewidth
andheight
of the<iframe>
to100%
. I set out to do this, when I noticed Chrome appears to not size the iframe like Firefox and Microsoft Edge do.I did find success with the following approach:
Results: http://jsfiddle.net/jonathansampson/o7bvefy1/
The solution is to add
min-height: 100%;
to theiframe
.