HTML CSS examples for CSS Layout:Responsive Layout
Make 1/3 screen and full screen background with responsive scaling
<html> <head> <title>Responsive background</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> * {<!--from w w w .j a v a 2s . c o m--> box-sizing:border-box; margin:0; padding:0; } html, body { width:100%; height:100%; overflow:hidden; } header { width:100%; height:61%; background-origin:border-box; background:url('http://www.java2s.com/style/demo/Google-Chrome.png') bottom center / cover no-repeat transparent; transition:all 501ms; } header>h1 { color:Chartreuse; text-shadow:0px 0px 9px yellow; } header, section, footer { padding:16px; } footer { border-top:2px solid blue; } @media (max-width: 767px) { header { width:100%; height:41%; background-origin:border-box; background:url('http://www.java2s.com/style/demo/Google-Chrome.png') center center / cover no-repeat transparent; transition:all 501ms; } } </style> </head> <body> <header> <h1>Header</h1> </header> <section> <p>Content</p> </section> <footer> <h2>Footer</h2> </footer> </body> </html>