CSS background below header - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Header

Description

CSS background below header

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

html,<!--from   w  ww .j a va  2  s . co m-->
body {
   height: 100%;
}

#container1,
#container2 {
   height: 100%;
}

#container1 {
   overflow: hidden;
   position: absolute;
}

#container2 {
   position: relative;
}

#bg {
   background: url('https://www.java2s.com/style/demo/Opera.png') repeat-x;
   min-height: 900px;
}

#content {
   color: white;
}

body {
   background-color: #888;
}

p {
   padding: 3em;
}

.header {
   background-image: linear-gradient(bottom, rgb(179, 179, 179) 0%, rgb(255, 255, 255) 63%);
   background-image: -o-linear-gradient(bottom, rgb(179, 179, 179) 0%, rgb(255, 255, 255) 63%);
   background-image: -moz-linear-gradient(bottom, rgb(179, 179, 179) 0%, rgb(255, 255, 255) 63%);
   background-image: -webkit-linear-gradient(bottom, rgb(179, 179, 179) 0%, rgb(255, 255, 255) 63%);
   background-image: -ms-linear-gradient(bottom, rgb(179, 179, 179) 0%, rgb(255, 255, 255) 63%);
   background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(179, 179, 179)), color-stop(0.63, rgb(255, 255, 255)));
}


      </style> 
 </head> 
 <body> 
  <title>test</title> 
  <div id="container1"> 
   <div class="header">
     header header header header header header header header header header header header header 
   </div> 
   <div id="bg"></div> 
  </div> 
  <div id="container2"> 
   <div class="header">
     header header header header header header header header header 
   </div> 
   <div id="content"> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
    <p>content content content content content content content content content </p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials