Navbar
To create a top navigation bar, use the <nav>
tag and
fill it with links, as such:
<nav>
<a href="/1.html">
Link 1
</a>
<a href="/2.html">
Link 2
</a>
</nav>
# <center>
The links in a navbar will be automatically stretched to fill the
available space. To prevent this, center the elements using a
<center>
tag.
<nav>
<center>
<a href="/1.html">
Link 1
</a>
<a href="/2.html">
Link 2
</a>
</center>
</nav>
# Buttons
To make your links appear like buttons, wrap each one with a
<button>
tag.
<nav>
<button>
<a href="/1.html">
Link 1
</a>
</button>
<button>
<a href="/2.html">
Link 2
</a>
</button>
</nav>
# Icons
To put an icon or logo in your navbar, create an image and it will automatically resize.
<nav>
<a href="/1.html">
<img src="/images/icon.png">
</a>
<a href="/2.html">
Link 2
</a>
</nav>
Support | Chrome | Safari | Firefox | Edge | Opera |
---|---|---|---|---|---|
<nav> |
5+ | 5+ | 4+ | 12+ | 11.5+ |
<center> |
All | All | All | All | All |
Buttons | All | 13.1+ | All | All | All |
Icons | All | 13.1+ | All | All | All |
Information for this support table comes from Can I Use.