How TO - Icon Bar







googletag.cmd.push(function() { googletag.display('div-gpt-ad-1422003450156-2'); });



How TO - Icon Bar



❮ Previous
Next ❯



Learn how to create icon bars with CSS.







Vertical:









Try it Yourself »





Horizontal:










 


Try it Yourself »







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>









googletag.cmd.push(function() { googletag.display('div-gpt-ad-1493883843099-0'); });






Step 2) Add CSS:


Vertical Example



.icon-bar {
    width:
90px; /* Set a specific width */
   
background-color: #555; /* Dark-grey background */
}

.icon-bar a {
   
display: block; /* Make the links appear below each other instead of
side-by-side */
    text-align: center; /* Center-align text
*/
    padding: 16px; /* Add some padding */
    transition: all 0.3s ease;
/* Add transition for hover effects */
   
color: white; /* White text color */
    font-size: 36px; /*
Increased font-size */
}

.icon-bar a:hover {
    background-color: #000; /* Add a hover
color */
}

.active {
   
background-color: #4CAF50; /* Add an active/current color */
}

Try it Yourself »



Horizontal Example



.icon-bar {
    width: 100%; /* Full-width */
    background-color: #555;
/* Dark-grey background */
   
overflow: auto; /* Overflow due to float */
}

.icon-bar a {
   
float: left; /* Float links side by side */
    text-align:
center; /* Center-align text */
   
width: 20%; /* Equal width (5 icons with 20% width each = 100%) */
    padding: 12px 0;
/* Some top and bottom padding */
    transition: all 0.3s ease;
/* Add transition for hover effects */
   
color: white; /* White text color */
    font-size: 36px; /*
Increased font size */
}

.icon-bar a:hover {
   
background-color: #000; /* Add a hover color */
}

.active {
   
background-color: #4CAF50; /* Add an active/current color */
}

Try it Yourself »



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.




❮ Previous
Next ❯

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?