Reputation: 1093
I'm trying to get a simple flex layout to work the same in IE11 as it does in Chrome.
In Chrome it appears like this:
However in IE11 it appears like this:
Here is the code :
html,
body {
margin: 2px 0 0 0;
padding: 0;
}
.wrap {
display: flex;
min-height: calc( 100vh - 8px);
flex-direction: column;
max-width: 1200px;
margin: auto;
border: 1px solid #222222;
}
.main {
flex: 1 1 auto;
display: flex;
}
header {
background: green;
padding: 10px;
}
#footer {
background: green;
padding: 10px;
}
.sidebar {
background: blue;
flex: 0 0 135px;
padding: 10px;
}
.content {
background: yellow;
padding: 10px;
flex: 1 1 auto;
}
@media screen and (max-width:680px) {
.sidebar {
flex: 0;
order: 2
}
.main {
flex-direction: column;
}
}
<body translate="no">
<div class="wrap">
<header>
<div class="header-inner-left">
</div>
<div class="header-inner">
</div>
</header>
<main class="main">
<div class="sidebar">
</div>
<div class="content">
</div>
</main>
<div id="footer">
<div class='footerleft'>
</div>
<div class='footerright'>
</div>
<div style="clear: both;"></div>
</div>
</div>
</body>
That shows the HTML & CSS. Is there anyway to make this look the same.
If I set .wrap
so it uses:
height: calc( 100vh - 8px );
Then the loading page looks correct, but I need the ability for the content to grown beyond the .wrap correctly so set min-height: calc( 100vh - 8px );
Is there any way to do this ? Thanks
Upvotes: 2
Views: 144
Reputation: 371261
Here's an idea that may work for you:
body {
display: flex;
}
.wrap {
min-height: 100vh;
flex-grow: 1;
display: flex;
flex-direction: column;
max-width: 1200px;
border: 1px solid #222222;
}
.main {
flex: 1 1 auto;
display: flex;
}
header {
background: green;
flex: 0 0 25px;
}
#footer {
background: green;
flex: 0 0 25px;
}
.sidebar {
background: blue;
flex: 0 0 135px;
padding: 10px;
}
.content {
background: yellow;
padding: 10px;
flex: 1 1 auto;
}
body {
margin: 0;
}
* {
box-sizing: border-box;
}
<div class="wrap">
<header>
<div class="header-inner-left"></div>
<div class="header-inner"></div>
</header>
<main class="main">
<div class="sidebar"></div>
<div class="content"></div>
</main>
<div id="footer">
<div class='footerleft'></div>
<div class='footerright'></div>
<div style="clear: both;"></div>
</div>
</div>
Upvotes: 2
Reputation: 67778
Do you really need display: flex
on .wrap
? because on https://caniuse.com/?search=calc you can find that "IE & Edge are reported to not support calc
inside a 'flex'."
So if you use display: block
instead, it might work on IE. In your CSS rule for .wrap
I see that you have flex-direction: column;
, but there are no other settings in that rule that would make a practical difference to using display: block
.
Upvotes: 0