DEV Community

Robson Muniz
Robson Muniz

Posted on • Updated on

How to Create Amazing Buttons With Icons using HTML & CSS

In today's video I'll be showing you how to create a button with icons using HTML & CSS. This is easily done, and can be added to your own website or project/Portfolio.
I show you the full front end coding tutorial, where I create the structure of the elements in HTML and then write all of the styling and effects with CSS from scratch, step-by-step!


<!DOCTYPE html>
<html lang="en">

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Create Buttons with Icons</title>
  <link rel="stylesheet" href="style.css">


  <button class="button">
    <span class="button__text">Like it</span>
    <span class="button__icon">
      <ion-icon name="heart-outline"></ion-icon>

  <script type="module" src=""></script>

Enter fullscreen mode Exit fullscreen mode


@import url('');

body {
    display: grid;
    height: 100vh;
    place-items: center;
    overflow: hidden;
    background: #20374e;
.button {
    display: flex;
    height: 50px;
    padding: 0;
    background: #2980b9;
    border: none;
    outline: none;
    border-radius: 5px;
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
    transition: all 160ms ease-in;
button:hover {
    background: #008168;

button:active {
    background: #006e58;
    transform: scale(.95);
.button__icon {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 24px;
    color: rgb(226, 226, 226);
.button__icon {
    font-size: 1.5em;
    background: rgb(0, 0, 0, 0.08);
Enter fullscreen mode Exit fullscreen mode

๐Ÿ›ด Follow me for more on:

Top comments (0)