Fixed background image - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Fixed background image

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">

.row1 {<!--from  w  w  w . java  2 s. c om-->
   height:45px;
   overflow: hidden;
}
.row1 div {
   height:47px;
   -webkit-backface-visibility: hidden;
   background: lightblue;
}
.row2 {
   position: relative;
   height:5000px;
   background-image:url(https://www.java2s.com/style/demo/InternetExplorer.png);
   background-position: 50% 47px;
   background-attachment: fixed;
   background-repeat: no-repeat;
}


      </style> 
 </head> 
 <body> 
  <div class="row1"> 
   <div> 
   </div> 
  </div> 
  <div class="row2"></div>  
 </body>
</html>

Related Tutorials