JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<div class="wrapper_in">
<header>Header</header>
<div class="content">Content</div>
</div>
<footer>Footer</footer>
</div>
CSS
html, body {
margin: 0;
padding: 0;
height: 100%;
}
.wrapper {
min-height: 100%;
position: relative;
}
.wrapper_in {
//padding-bottom: 30px;
}
header {
background-color: #f00;
color: #fff;
height: 30px;
}
.content {
background-color: #0f0;
color: #fff;
}
footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background-color: #00f;
color: #fff;
}
JavaScript
function fit_content(){
$('.content').height('auto')
var window_height = $(window).height(),
header_height = $('header').height(),
footer_height = $('footer').height(),
content_height = $('.content').height();
console.log(window_height);
if (window_height > header_height + footer_height + content_height)
$('.content').height(window_height - header_height - footer_height);
}
fit_content();
$(window).resize(fit_content);