JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Title</h1>
<nav>Changeable Menu Items In A List</nav>
<section>
Lots of items which are changing all the time.
</section>
<footer>Footer</footer>
CSS
body {
background-color: #ff0000;
background: -ms-linear-gradient(top left, #d00 0%, #f33 50%, #611 100%);
background: linear-gradient(top left, #d00 0%, #f33 50%, #611 100%);
margin: 0;
overflow: hidden;
}
h1, nav, footer {
background-color: rgba(40, 40, 40, 0.4);
margin: 0;
padding: 10px;
}
section {
overflow-y: scroll;
padding: 10px;
}
JavaScript
$(function () {
var thereIsNoTry = function () {
$('section').css({ height:
$(window).height() -
$('h1').height() -
$('nav').height() -
$('footer').height() -
parseInt($('h1').css('padding-top')) -
parseInt($('h1').css('padding-bottom')) -
parseInt($('nav').css('padding-top')) -
parseInt($('nav').css('padding-bottom')) -
parseInt($('footer').css('padding-top')) -
parseInt($('footer').css('padding-bottom')) -
parseInt($('section').css('padding-top')) -
parseInt($('section').css('padding-bottom'))
});
};
$(window).resize(thereIsNoTry);
thereIsNoTry();
//In case you're updating the DOM
$(document).ajaxSuccess(thereIsNoTry);
var oldAnimate = jQuery.fn.animate;
//In case the header can be animated
jQuery.fn.animate = function (properties, duration,
animation, easing) {
if (arguments.length == 4) {
return oldAnimate.call(this, properties,
duration, animation, easing);
}
if (arguments.length == 3) {
return oldAnimate.call(this, properties,
duration, animation);
}
if (arguments.length == 2 && typeof duration === 'object') {
var options = {
progress: function (animation, progress, remainingMs) {
if (duration.progress) {
duration.progress.call(this, animation,
...