HTML Element Style How to - Add footer to a Div element








Question

We would like to know how to add footer to a Div element.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#slide-banner {<!--   w  w w  .  j av  a 2s . com-->
  margin-top: 70px;
  margin-right: auto;
  margin-left: auto;
  padding: 0px 0px 0px 0px;
  height: 350px;
  width: 316px;
  border: 1px solid #ccc;
  overflow: hidden;
  position: relative;
}

#slide-banner img {
  height: auto;
  width: 916px;
}

#slide-banner-snippet {
  height: 55px;
  width: 916px;
  background-color: #000;
  position: absolute;
  bottom: 0;
  color:white;
}
</style>
</head>
<body>
  <div id="slide-banner">
    <img src="http://www.java2s.com/style/download.png" />
    <div id="slide-banner-snippet">banner</div>
  </div>
</body>
</html>

The code above is rendered as follows: