CSS
First of all, we need to set the value of margin and padding to 0 for our list.
- #nav ul {
- margin: 0px;
- padding: 0px;
- }
We dont want bullets for this list. Therefore, we have to set list-style property to none.
- #nav ul {
- margin: 0px;
- padding: 0px;
- list-style: none; /* new property added */
- }
Right now, it will appear as a vertical list. since we want a horizontal navigation bar, we will have to display each element of the list as blocks, and float them to left.
- #nav ul li,
- #nav ul li a {
- float: left;
- display: block;
- }
Lets style if up a bit more (up to you now) by adding some hover effects and background colour.
- #nav ul li a {
- padding: 20px;
- font-family: arial;
- font-size: 24px;
- background-color: #eee;
- color: #000;
- }
- #nav ul li a:hover {
- background-color: #ccc;
- }
Done! Open your web page in a browser, and you should see a navigation bar just like the image above.













