Horizontally centre table cell in CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

Horizontally centre table cell in CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor s</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
li {<!--   w w w . j  ava  2 s.c o  m-->
   width:201px;
   height:61px;
   border:2px solid Chartreuse;
   text-align:center;
   list-style-type:none;
}

li .inner {
   width:100px;
   height:31px;
   border:2px solid yellow;
   margin:0 auto;
}

ul {
   padding-left:0;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li> 
    <div class="inner">
      Lorem i 
    </div> </li> 
  </ul>  
 </body>
</html>

Related Tutorials