HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Vertical
Having easy-to-use navigation is important for any web site.
With CSS you can transform boring HTML menus into good-looking navigation bars.
A navigation bar needs standard HTML as a base.
In our examples we will build the navigation bar from a standard HTML list.
A navigation bar is basically a list of links, so using the <ul> and <li> elements makes perfect sense:
<ul>
<li><a href="default">Home</a></li>
<li><a href="news">News</a></li>
<li><a href="contact">Contact</a></li>
<li><a href="about">About</a></li>
</ul>
Now let's remove the bullets and the margins and padding from the list:
ul
{
list-style-type: none;
margin: 0;
padding: 0;
}
Example explained:
list-style-type: none;
- Removes the bullets. A navigation bar
does not need list markersmargin: 0;
and padding: 0;
to remove browser default settingsThe code in the example above is the standard code used in both vertical, and horizontal navigation bars, which you will learn more about in the next chapters.