How to create icon buttons with CSS?

CSSWeb DevelopmentFront End Technology

Following is the code to create icon buttons with CSS −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet"
button {
   font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
   "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
   background-color: rgb(30, 173, 255);
   border: none;
   color: white;
   padding: 12px 16px;
   font-size: 32px;
   cursor: pointer;
i {
   padding: 15px;
   color: rgb(33, 0, 109);
button:hover {
   background-color: rgb(81, 44, 148);
button:hover i {
   color: white;
<h1 style="font-size: 60px; font-family: Arial, Helvetica, sans-serif;">
Icon Buttons Example
<button><i class="fa fa-home"></i>Home</button>
<i class="fa fa-phone-square" aria-hidden="true"></i>Call Us
<button><i class="fa fa-map-marker" aria-hidden="true"></i>Visit Us</button>
<button><i class="fa fa-cog" aria-hidden="true"></i>Settings</button>
<button><i class="fa fa-user-o" aria-hidden="true"></i>Login</button>


The above code will produce the following output −

On hovering above the icon buttons −

Published on 08-Apr-2020 08:53:30