Use background-size: cover - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Use background-size: cover

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <style>

.intro {<!-- w w w.ja  va2s. c o m-->
   background: url('https://www.java2s.com/style/demo/Safari.png') no-repeat center center fixed;
   -webkit-background-size: cover;
   -moz-background-size: cover;
   -o-background-size: cover;
   -ms-ie-background-size: cover;
   background-size: cover;
   top: 0px;
   right: 0px;
   left: 0px;
}

      </style> 
 </head> 
 <body> 
  <div class="intro">
    test 
  </div>  
 </body>
</html>

Related Tutorials