How to create: download button

Learn how to use CSS to set the style of the download button.

Auto width:

Full width:

Try It Yourself

How to create a download button

Step 1 - Add HTML:

Add an icon library, such as Font Awesome, and attach the icon to the HTML button:

<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Auto width -->
<button class="btn"><i class="fa fa-download"></i> Download</button>
<!-- Full width -->
<button class="btn" style="width:100%"><i class="fa fa-download"></i> Download</button>

Step 2 - Add CSS:

/* Set button style */
.btn {
  background-color: DodgerBlue;
  border: none;
  color: white;
  padding: 12px 30px;
  cursor: pointer;
  font-size: 20px;
}
/* Mouse hover changes background to dark */
.btn:hover {
  background-color: RoyalBlue;
}

Try It Yourself

Related Pages

Tutorial:Icon Tutorial

Tutorial:CSS Button