How To Create A Responsive Navigation Menu With Icons
How To Create A Responsive Navigation Menu With Icons
How To Create A Responsive Navigation Menu With Icons
Learn how to create a responsive navigation menu with icons, using CSS.
Try it Yourself »
https://www.w3schools.com/howto/howto_css_navbar_icon.asp 1/7
12/11/2019 How To Create a Responsive Navigation Menu with Icons
Example
HTML CSS JAVASCRIPT MORE
<div class="navbar">
<a class="active" href="#"><i class="fa fa-fw fa-home"></i> Home</a>
<a href="#"><i class="fa fa-fw fa-search"></i> Search</a>
<a href="#"><i class="fa fa-fw fa-envelope"></i> Contact</a>
<a href="#"><i class="fa fa-fw fa-user"></i> Login</a>
</div>
Example
/* Style the navigation bar */
.navbar {
width: 100%;
background-color: #555;
overflow: auto;
}
/* Navbar links */
.navbar a {
float: left;
text-align: center;
https://www.w3schools.com/howto/howto_css_navbar_icon.asp 2/7
12/11/2019 How To Create a Responsive Navigation Menu with Icons
padding: 12px;
HTML CSS JAVASCRIPT
color: white;
MORE
text-decoration: none;
font-size: 17px;
}
/* Add responsiveness - will automatically display the navbar vertically instead of horizontally on screens less
than 500 pixels */
@media screen and (max-width: 500px) {
.navbar a {
float: none;
display: block;
}
}
Try it Yourself »
Tip: Go to our CSS Navbar Tutorial to learn more about navigation bars.
https://www.w3schools.com/howto/howto_css_navbar_icon.asp 3/7
12/11/2019 How To Create a Responsive Navigation Menu with Icons
Tip: If you want to create a navigation bar that only contains icons, read our How To - Icon Bar Tutorial.
HTML CSS JAVASCRIPT MORE
❮ Previous Next ❯
COLOR PICKER
HOW TO
Tabs
Dropdowns
Accordions
Side Navigation
Top Navigation
Modal Boxes
Progress Bars
Parallax
Login Form
HTML Includes
Google Maps
Range Sliders
https://www.w3schools.com/howto/howto_css_navbar_icon.asp 4/7