centralize a list with css - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

centralize a list with css

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">
.header_middle_menu {
   float:left;
   margin-left:51px;
   margin-top:16px;
   width:491px;
   text-align:center;
}

.header_middle_menu li {
   width:100px;
}

.header_middle_menu ul {
   list-style:none;
}

.header_middle_menu ul li {
   background:Chartreuse;
   display:inline-block;
   margin:6px;
   padding:8px;
}

.header_middle_menu ul li a {
   color:yellow;
   font-family:arial;
   font-size:14px;
   text-decoration:none;<!--from   www .ja v a 2  s . c  o  m-->
}

.header_middle_menu li:hover ul {
   display:block;
}
</style> 
 </head> 
 <body> 
  <div class="header_middle_menu"> 
   <ul> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
    <li> <a href="#">L</a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials