Page Widget How to - Fix footer to bottom








Question

We would like to know how to fix footer to bottom.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
root {<!--   www.  j a  v a  2  s.  c  o m-->
  display: block;
}

body {
  position: relative;
}

header, footer {
  position: fixed;
  width: 100%;
  background-color: black;
}

header {
  top: 0;
  height: 50px;
}

footer {
  bottom: 0;
  height: 100px;
}

section {
  position: relative;
  width: 100%;
  height: 1400px;
}
</style>
</head>
<body>
  <header></header>
  <section></section>
  <footer></footer>
</body>
</html>

The code above is rendered as follows: