JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="header"></div>
<div class="content">D</div>
<div class="footer"></div>
</div>
CSS
html,body
{
padding: 0px;
margin: 0px;
color: #555;
font-size: 20px;
font-family: "Open Sans","lucida grande","Segoe UI",arial,verdana,"lucida sans unicode",tahoma,sans-serif;
height: 100%;
}
.container
{
height: 100%;
background-color: Green;
position: relative;
}
.header
{
position: relative;
height: 150px;
width: 100%;
background-color: Red;
z-index: 1; /* higher than z-index of content */
}
.content
{
width: 100%;
position: relative;
top: -150px; /* - height of header */
padding-top: 150px; /* + height of header */
margin-bottom: -350px; /* - (height of header + height of footer) */
padding-bottom: 200px; /* height of footer */
height: auto;
min-height: 100%;
box-sizing: border-box;
z-index:0; /* lower than z-index of header */
background-color: Black;
}
.footer
{
height: 200px;
width: 100%;
background-color: Violet;
position: relative;
bottom: 0px;
}