HTML CSS examples for CSS Layout:Responsive Layout
Responsive background-image leaving white space when resized
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> html, body { height:100%; width:100%; } #container {<!--from www. jav a 2 s. c om--> height:100%; width:100%; } #background-image { background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png'); height:321px; width:100%; display:block; background-size:contain; background-repeat:no-repeat; } </style> </head> <body> <div id="container"> <div id="background-image"></div> <p>Lorem</p> </div> </body> </html>