2234 0 0 0
Last Updated : 2025-04-28 18:51:12
Sometimes you will need to show the footer at the bottom of the page when there is little or not content. and not directly after the contents because this makes the footer alittle bit lifted up and not elegantly shown on the page.
There are numerous solutions & suggestions for this situation, Here are some of them:
<header>
Header
</header>
<div class="pageContainer">
<div class="contents">
Contents
</div>
<footer>
Footer
</footer>
</div>
<style>
*{padding:0px; margin:0px;}
.pageContainer{
background-color:#EAEAEA;
/* min-height: 100vh; */
min-height: calc( 100vh - 80px );
position: relative;
padding-top: 80px;
}
.contents{
border: 1px solid red;
height: 600px;
padding-bottom: 50px;
}
header{
background-color: aqua;
height: 80px;
z-index: 100;
position: absolute;
left: 0px;
right: 0px;
}
footer{
background-color: #fff;
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
height: 50px;
}
</style>?