Center and give a fixed width to a content inside a 100% width background - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Center and give a fixed width to a content inside a 100% width background

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">

.something-wrapper {<!--from   w w  w  .jav a  2  s.co m-->
   width: 100%;
   background: #fff000;
   text-align: center;
}
.something {
   display: inline-block;
   background:#fffddd;
   color:fff;
   width:400px;
   text-align: left;
}


      </style> 
 </head> 
 <body> 
  <div class="something-wrapper"> 
   <div class="something">
     Lorem ipsum dolor sit amet, consectetur adip Seat eros ornare pharetra orci at eros orn are nec nec conse cd pheros ornare pharetra orci at e aretra orci at eeros ornare pharetra ipsum dolor sit amet, consectetur adip or. Sed pharetra orci at eros orci 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials