HTML CSS examples for CSS Widget:Nav bar alignment
Centering a nav bar horizontally
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> header {<!-- w w w.jav a2 s . c o m--> position:relative; display:block; } header:after { visibility:hidden; display:block; font-size:0; content:" "; clear:both; height:0; } header img { height:auto; width:26%; float:left; } header nav { width:71%; font-size:2em; position:absolute; top:51%; line-height:201%; margin-top:-3em; } header nav li { display:inline-block; width:20%; } header nav li a { font-size:2em; text-decoration:none; color:Chartreuse; } </style> </head> <body> <div id="header"> <header role="banner"> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> <nav id="navigation" role="navigation"> <ul> <li> <a href="#" title="About Us">Lorem ip</a> </li> <li> <a href="#" title="Biographies">Lorem ipsum</a> </li> <li> <a href="#" title="Services">Lorem ip</a> </li> <li> <a href="#" title="Careers">Lorem i</a> </li> <li> <a href="#" title="Contact">Lorem i</a> </li> </ul> </nav> </header> </div> </body> </html>