center my div in responsive design way - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

center my div in responsive design way

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">
#Outer {<!--  ww w.  j  a  v  a  2 s. com-->
   width:151px;
   height:151px;
   background:yellow;
   text-align:center;
}

#Inner {
   display:inline-block;
   background:red;
   margin-left:auto;
   margin-right:auto;
}

#Inner div {
   display:inline-block;
}
</style> 
 </head> 
 <body> 
  <div id="Outer"> 
   <div id="Inner"> 
    <div>
      Lorem 
    </div> 
    <div>
      Lorem 
    </div> 
    <div>
      Lorem 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials