HTML CSS examples for CSS Widget:Nav Bar Item
Center the item in a navigation bar
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #cssmenu ul<!--from w w w. j av a2 s.c o m--> { margin:0; padding:0; list-style-type:none; width:auto; position:relative; display:block; height:31px; font-size:13px; font-weight:bold; background:transparent url('https://www.java2s.com/style/demo/Google-Chrome.png') repeat-x top left; font-family:Arial, Helvetica, sans-serif; border-bottom:2px solid Chartreuse; border-top:2px solid yellow; text-align:center; } #cssmenu li { display:inline-block; margin-left:16px; padding:0; margin-right:16px; } #cssmenu li a { display:block; float:left; color:blue; height:23px; text-decoration:none; font-weight:bold; padding:9px 21px 0 21px; } #cssmenu li a:hover { color:pink; height:23px; background:transparent url('https://www.java2s.com/style/demo/Google-Chrome.png') 0px -31px no-repeat; } #cssmenu li.active a { display:inline; background:transparent url('https://www.java2s.com/style/demo/Google-Chrome.png') 0px -31px no-repeat; float:left; margin:0; } </style> </head> <body> <div id="cssmenu"> <ul> <li class="active"> <a href="index.html"> <span>Lore</span> </a> </li> <li> <a href="#"> <span>Lorem ip</span> </a> </li> <li> <a href="#"> <span>Lorem</span> </a> </li> <li class="last"> <a href="#"> <span>Lorem i</span> </a> </li> </ul> </div> </body> </html>