Flex iframe doesn't stretch in IE11 |
Flex iframe doesn't stretch in IE11 |
RainLover |
Apr 22 2014, 05:41 AM
Post
#1
|
Advanced Member Group: Members Posts: 216 Joined: 16-November 09 Member No.: 10,346 |
The following iframe is a flex item and is supposed to stretch and fill the available space:
CODE <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Flex Iframe</title> <style> body { display: flex; margin: 0; height: 100vh; } span { background: green; } iframe { background: tan; } </style> </head> <body> <span>Hello, world!</span> <iframe></iframe> </body> </html> But in IE11 it doesn't look right: DEMO Is it a bug? What's a cross-browser solution? |
CharlesEF |
Apr 22 2014, 06:59 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
If you add width: 100%; to your iframe section won't that fix it?
|
Christian J |
Apr 22 2014, 08:08 AM
Post
#3
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
I don't have an IE11, but this should work in older browsers:
CODE html, body, iframe, span { height: 100%; margin: 0; border: 0; } span { background: green; display: inline-block; } iframe { background: tan; vertical-align: top; } |
RainLover |
Apr 22 2014, 01:29 PM
Post
#4
|
Advanced Member Group: Members Posts: 216 Joined: 16-November 09 Member No.: 10,346 |
If you add width: 100%; to your iframe section won't that fix it? You mean height:100%;? But what if things get a little complicated like this: CODE <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Flex Iframe</title> <style> body { display: flex; flex-direction: column; margin: 0; height: 100vh; } header { background: yellow; } main { display: flex; flex: 1; } span { background: green; } iframe { background: tan; } </style> </head> <body> <header>Some text</header> <main> <span>Hello, world!</span> <iframe></iframe> </main> </body> </html> |
RainLover |
Apr 22 2014, 01:35 PM
Post
#5
|
Advanced Member Group: Members Posts: 216 Joined: 16-November 09 Member No.: 10,346 |
|
Christian J |
Apr 22 2014, 03:38 PM
Post
#6
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
I don't have an IE11, but this should work in older browsers: Thanks for the answer, but I'm looking for a solution in IE11. It should work in IE11 too. My guess is that IE11 is buggy, but since I don't have it I can't check. Also I'm not familiar with Flex layouts. How does your original example deviate in IE11? |
Frederiek |
Apr 22 2014, 04:08 PM
Post
#7
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
FYI, display flex and flex-direction column are supported in IE 10+, so that shouldn't be the issue here.
See http://css-tricks.com/almanac/properties/d/display/ and http://css-tricks.com/snippets/css/a-guide-to-flexbox/ . |
RainLover |
Apr 22 2014, 08:58 PM
Post
#8
|
Advanced Member Group: Members Posts: 216 Joined: 16-November 09 Member No.: 10,346 |
|
Lo-Fi Version | Time is now: 19th April 2024 - 07:28 PM |