Page Widget How to - Cover header with image








Question

We would like to know how to cover header with image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
html, body {<!--from w  ww . j av  a2s .com-->
  height: 100%;
  margin: 0;
  padding: 0;
}

.header {
  background: url(http://www.java2s.com/style/download.png) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  height: inherit;
}
</style>
</head>
<body>
  <div class="header"></div>
  <p>Content below header</p>
</body>
</html>

The code above is rendered as follows: