HTML CSS examples for CSS Widget:UL Alignment
Center ul in container and keep li left aligned
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #nav {<!-- w w w .ja v a 2s. c o m--> } .inner { margin:3px; display:inline-block; width:201px; height:51px; background:Chartreuse; } #container ul { background:tomato; list-style:none; padding:0; margin:0 auto; width:96%; } #container ul li { display:inline; } </style> </head> <body> <div id="container"> <ul> <li> <div class="inner"></div> </li> <li> <div class="inner"></div> </li> <li> <div class="inner"></div> </li> <li> <div class="inner"></div> </li> </ul> </div> </body> </html>