HTML CSS examples for CSS Widget:Nav bar alignment
Navigation bar covers the screen entirely
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #nav {<!-- w w w . j a v a2 s. c o m--> width:100%; float:left; margin:0 0 0 0; padding:0; background-color:Chartreuse; border-bottom:5px solid yellow; position:absolute; top:-2px; margin-right:-6px; } #nav ul { list-style:none; width:801px; margin:auto; padding:0px; right:-6px; } #nav li { float:left; right:-6px; } #nav li a { display:inline-block; padding:11px 21px; text-decoration:none; font-weight:bold; color:blue; border-right:0px solid pink; } #nav li:first-child a { border-right:0px solid OrangeRed; } #nav li a:hover { color:grey; background-color:BlueViolet; right:-6px; } #home { float:left; display:inline-block; } body { margin:0; padding:0; } </style> </head> <body> <header> <div id="nav"> <ul> <li> <a id="home" href="index.html"> <img src="https://www.java2s.com/style/demo/Firefox.png" width="28" height="28"> </a> </li> <li> <a href="#">Lorem</a> </li> <li> <a href="#">Lorem</a> </li> <li> <a href="#">Lorem ip</a> </li> </ul> </div> </header> </body> </html>