Menu
How TO – Icon Bar
Learn how to create icon bars with CSS.
Vertical:
Try it Yourself
<!DOCTYPE html>
<html>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”>
<style>
body {margin:0}
.icon-bar {
width: 90px;
background-color: #555;
}
.icon-bar a {
display: block;
text-align: center;
padding: 16px;
transition: all 0.3s ease;
color: white;
font-size: 36px;
}
.icon-bar a:hover {
background-color: #000;
}
.active {
background-color: #04AA6D;
}
</style>
<body>
<div>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
</div>
</body>
</html>
Horizontal:
Try it Yourself
<!DOCTYPE html>
<html>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”>
<style>
body {margin:0;}
.icon-bar {
width: 100%;
background-color: #555;
overflow: auto;
}
.icon-bar a {
float: left;
width: 20%;
text-align: center;
padding: 12px 0;
transition: all 0.3s ease;
color: white;
font-size: 36px;
}
.icon-bar a:hover {
background-color: #000;
}
.active {
background-color: #04AA6D;
}
</style>
<body>
<div>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
</div>
</body>
</html>
How To Create an Icon Bar
Step 1) Add HTML:
Example
<!– Add icon library –>
<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”>
<div class=”icon-bar”>
<a class=”active” href=”#”><i class=”fa fa-home”></i></a>
<a href=”#”><i class=”fa fa-search”></i></a>
<a href=”#”><i class=”fa fa-envelope”></i></a>
<a href=”#”><i class=”fa fa-globe”></i></a>
<a href=”#”><i class=”fa fa-trash”></i></a>
</div>
Step 2) Add CSS:
Example
<!DOCTYPE html>
<html>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”>
<style>
body {margin:0}
.icon-bar {
width: 90px;
background-color: #555;
}
.icon-bar a {
display: block;
text-align: center;
padding: 16px;
transition: all 0.3s ease;
color: white;
font-size: 36px;
}
.icon-bar a:hover {
background-color: #000;
}
.active {
background-color: #04AA6D;
}
</style>
<body>
<div>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
</div>
</body>
</html>
Horizontal Example
<!DOCTYPE html>
<html>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css”>
<style>
body {margin:0;}
.icon-bar {
width: 100%;
background-color: #555;
overflow: auto;
}
.icon-bar a {
float: left;
width: 20%;
text-align: center;
padding: 12px 0;
transition: all 0.3s ease;
color: white;
font-size: 36px;
}
.icon-bar a:hover {
background-color: #000;
}
.active {
background-color: #04AA6D;
}
</style>
<body>
<div>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
<a href=”#”><i></i></a>
</div>
</body>
</html>
Related Pages
Tip: Go to our CSS Navbar Tutorial to learn more about navigation bars.
Tip: Go to our Icons Tutorial to learn more about icons.