Aligning a div with list in it to the center with display: inline-block - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Div Align

Description

Aligning a div with list in it to the center with display: inline-block

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">
ul {<!--  ww w.  j a  v  a  2s.  c om-->
   list-style:none;
   margin:0px;
   padding:0px;
}
</style> 
 </head> 
 <body> 
  <div style="text-align:center;width:100%"> 
   <div style="margin: 0 auto; display: inline-block;"> 
    <ul> 
     <li>Example</li> 
     <li>Example</li> 
     <li>Example</li> 
    </ul> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials