Different background color on either side of page - HTML CSS CSS Property

HTML CSS examples for CSS Property:background-color

Description

Different background color on either side of page

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style type="text/css">

body {<!--from w w  w.  ja v  a2  s.  co m-->
   padding: 0;
   margin: 0;
}
#container {
   width: 100%;
   min-height: 100%;
   position: relative;
}
#left, #right {
   width: 50%;
   height: 100%;
   position: absolute;
   z-index: -1;
}
#left {
   left: 0;
   background-color: navy;
}
#right {
   right: 0;
   background-color: maroon;
}
#content {
   width: 512px;
   height: 100%;
   margin: 0 auto;
   background-color: white;
}


      </style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="left"></div> 
   <div id="right"></div> 
   <div id="content">
     Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> Hi 
    <br> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials