Set the background color for a variable height page - HTML CSS CSS Property

HTML CSS examples for CSS Property:background-color

Description

Set the background color for a variable height page

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 {<!--   www . j av  a  2  s.co  m-->
   height: 100%;
   width: 100%;
   background: #efefef;
   margin: 0px;
   padding: 0px;
}

#content_container {
   width: 500px;
   margin: auto;
   background: #ff0000;
   border: 1px solid #ababab;
   min-height: 100px;
}
      </style> 
 </head> 
 <body> 
  <div id="content_container"> 
   <div>
     this is a test this is a test this is a test this is a test this is a test this is a test 
     this is a test this is a test this is a test this is a test this is a test this is a test 
     this is a test this is a test this is a test this is a test this is a test this is a test 
     this is a test this is a test this is a test this is a test this is a test this is a test 
   </div> 
   <br> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
   <div>
     Content here 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials