I have a simple layout: header + sidebar + content + footer
.
The root
element has a flex display with row direction
; root = sidebar + wrapper
. The wrapper = header + content + footer
. The wrapper
is displayed as flex and has flex direction of column
.
When the content is a single word, the footer is visible just fine, however once I replace the content with a lot of text, the footer disappears (pics below).
JsFiddle with little content: https://jsfiddle.net/3mfdu8ey/1/
JsFiddle with a lot of content: https://jsfiddle.net/3mfdu8ey/2/
And once I scroll the second fiddle to the end:
The footer is gone. I tried fixing it with
height: calc(100vh - 200);
on #content-wrapper
, but it didn't work.
My code:
html:
<div id = "app">
<div id = "custom-sidebar">
Sidebar
</div>
<div id = "content-wrapper">
<div id = "header">
Header
</div>
<div id = "content">
Content
</div>
<div id = "footer">
Footer
</div>
</div>
</div>
css:
#content-wrapper {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 100%;
height: calc(100vh - 200);
}
#content {
padding: 30px;
}
#app {
background-color: gray;
display: flex;
height: 100vh;
font-family: 'Source Sans Pro', sans-serif;
padding: 0;
}
#header {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
padding-bottom: 20px;
}
#sidebar {
width: 12%;
float: left;
display: flex;
flex-direction: column;
justify-content: center;
}
#footer {
height: 200px;
width: 100%;
}
/*
Colors
*/
#custom-sidebar {
background-color: orange;
}
#footer {
background-color: green;
}
#header {
background-color: red;
}
#content {
background-color: silver;
}