The following Grid layout works fine in the latest versions of Chrome, Firefox, Opera, IE 10/11 and Edge. The only issue at hand, is that for the three Microsoft browsers mentioned the footer doesn't start to scroll when content grows beyond the screen size, but stays fixed in the middle of the page. In the other words, longer content overwrites the footer.
I've been doing a fair amount of research over the passed days. Unfortunately to no avail. Many of the proposed solutions work by moving the footer outside of the wrapper, however, I am looking for a technique that fits into the given markup of the page.
It's most likely some height issue I suppose, but since I ran out of ideas to try, I've decided to take things to this list. Maybe one of you all can give me a spark.
Any pointers on how to approach this one are appreciated.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
width: 100%;
height: 100%;
}
body {
min-height: 100%;
height: 100%;
}
/* main grid layout start */
.wrapper {
height: 100vh;
display: grid;
display: -ms-grid;
grid-template-columns: 10% 80% 10%;
grid-template-rows: 45px 50px 1fr 50px;
grid-template-areas: "header header header" "navigation navigation navigation" "column-left column-center column-right" "footer footer footer";
min-height: 100vh;
-ms-grid-columns: 10% 80% 10%;
-ms-grid-rows: 45px 50px 1fr 50px;
}
.item-header {
background-color: pink;
grid-area: header;
-ms-grid-row: 1;
-ms-grid-column: 1;
-ms-grid-column-span: 3;
}
.item-nav {
background-color: silver;
grid-area: navigation;
-ms-grid-row: 2;
-ms-grid-column: 1;
-ms-grid-column-span: 3;
}
.item-leftcol {
background-color: skyblue;
grid-area: column-left;
-ms-grid-row: 3;
-ms-grid-column: 1;
}
.item-centercol {
grid-area: column-center;
-ms-grid-row: 3;
-ms-grid-column: 2;
}
.item-rightcol {
background-color: tomato;
grid-area: column-right;
-ms-grid-row: 3;
-ms-grid-column: 3;
}
.item-footer {
background-color: green;
text-align: center;
padding: 10px;
grid-area: footer;
-ms-grid-row: 4;
-ms-grid-column: 1;
-ms-grid-column-span: 3;
display: flex;
display: -ms-flexbox;
/* only IE10 */
}
/* flex layout for footer start */
.fc1 {
background-color: red;
text-align: left;
flex-grow: 1;
flex-basis: 0;
-ms-flex-positive: 1; // flex-grow
-ms-flex-preferred-size: 0; // flex-basis
}
.fc2 {
background-color: red;
text-align: center;
flex-grow: 1;
flex-basis: 0;
-ms-flex-positive: 1; // flex-grow
-ms-flex-preferred-size: 0; // flex-basis
}
.fc3 {
background-color: red;
text-align: right;
flex-grow: 1;
flex-basis: 0;
-ms-flex-positive: 1; // flex-grow
-ms-flex-preferred-size: 0; // flex-basis
}
/* flex layout for footer end */
<div class="wrapper">
<div class="item-header">header</div>
<div class="item-nav">nav</div>
<div class="item-leftcol">left</div>
<div class="item-centercol">center</div>
<div class="item-rightcol">right</div>
<div class="item-footer">
<div class="fc1">footer</div>
<!-- just added this -->
<div class="fc2">footer</div>
<!-- just added this -->
<div class="fc3">footer</div>
<!-- just added this -->
</div>
</div>