Responsive background image - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive 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">
body, html, div#background-image {
   width:100%;
   height:100%;
   margin:0;
   padding:0;
}

div#background-image {
   background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   background-size:cover;
   background-position:center center;
}
</style> <!--from   w ww. j  a  va  2 s. com-->
 </head> 
 <body> 
  <div id="background-image"></div>  
 </body>
</html>

Related Tutorials