HTML CSS examples for CSS Widget:Nav bar alignment
Navigation bar centering with red background
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> nav {<!--from w ww .ja v a2 s . com--> position:relative; margin-left:auto; margin-right:auto; width:81%; } nav ul { padding:0; list-style:none; } nav ul li { display:inline; } nav ul li a { display:inline-block; text-decoration:none; padding:6px 0; width:21%; background:Chartreuse; color:yellow; float:left; text-align:center; border-left:2px solid blue; } nav ul li a:hover { background:pink; color:OrangeRed; } </style> </head> <body> <nav> <ul> <li> <a href="Index">Lore</a> </li> <li> <a href="History">Lorem i</a> </li> <li> <a href="Appointments">Lorem ipsum </a> </li> <li> <a href="Contactus">Lorem ipsu</a> </li> </ul> </nav> </body> </html>