Get header to span the page - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Header

Description

Get header to span the 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">

.contained<!-- w  w w .  jav  a 2  s  . c  o m-->
{
   width:500px;
   background-color:#EFE;
   position:relative;
   margin:auto;
}
header
{
   width:100%;
   color:#FFF;
   font-size:1.5em;
   background-color:#000;
   text-align:center;
   padding:8px 0;
}
      </style> 
 </head> 
 <body> 
  <div class="contained"> 
   <header>
     This is contained 
   </header> 
   <div>
     Some Content 
   </div> 
  </div> 
  <header>
    This is not Contained 
  </header> 
  <div class="contained">
    Some other content 
  </div>  
 </body>
</html>

Related Tutorials