CSS Navigation Bar


Having easy-to-use navigation is important for any web site. With CSS you can transform boring HTML menus into good-looking navigation bars.

Navigation Bar = List of Links
A navigation bar needs standard HTML as a base. The following examples build the navigation bar from a standard HTML list, so using the <ul> and <li> elements makes perfect sense:

     


To remove the bullets and the margins and padding from the above list, use the CSS on the right:
1ul {
2 list-style-type:none;
3 margin:0padding:0; }

Vertical Navigation Bar
To build a vertical navigation bar, style the <a> elements in addition to the code above:
1a {
2 display:block;
3 width:100px;
4 background-color:#dddddd; }

Demonstration
The following demonstration shows how the script of HTML and CSS is displayed on the Web: