-3

How can I fix a footer to the bottom of my page? One page might be very long (in which case the user would need to scroll in order to see the footer) or the page might be short. (in which case the footer could be visible on page load). I am trying to avoid the situation where I have a footer that is not positioned at the bottom of the page when the page has little content.

Mark
  • 9,718
  • 6
  • 29
  • 47

2 Answers2

0

There is few options. For example my favorite way to resolve this problem

<html>
<body>

<div class="wrapper">

  <div class="content"></div>

  <div class="footer"></div>

</div>

</body>
</html>
* {
      margin: 0;
      padding: 0;
    }
    html,
    body,
    .wrapper {
      height: 100%;
    }
    .content {
      box-sizing: border-box;
      min-height: 100%;
      padding-bottom: 90px;
    }
    .footer {
      height: 80px;
      margin-top: -80px;
    }
0
body {min-height :100vh} 
footer {
margin-bottom : 0; 
position: relative
} 

PS: sorry for bad formatting, i am on smartphone

Yakke
  • 54
  • 4