NOTE: This tutorial is depreciated and no longer needed due to a Divi update.

Our blood, sweat, and tears helped many of you. But ultimately updates like this are progress in the right direction for Divi!

Subscribe On YouTube

Join other subscribers and enjoy other Divi video tutorials!

How To Replace The Divi Button Icon With A Font Awesome Icon

Nelson Miller Profile Orange
In this tutorial I will show you how to replace the default Divi Button module icons with Font Awesome icons!

▶️ Please watch the video above to get all the exciting details! 👆

Connect Font Awesome To Divi

Since this guide is all about replacing the standard icon with a Font Awesome icon, the first step would be to ensure that you have Font Awesome connected to your Divi website.

We have a dedicated guide about How To add Font Awesome Icons To Divi. Once you have that connected you can proceed to the other steps.

How To Connect And Add Font Awesome Icons To Divi Tutorial by Pee Aye Creative

Add A Custom CSS Class To The Button Module

Now go to the desired Divi Button module and open settings. Go to the Advanced tab and open the CSS ID & Classes toggle. There you can write your custom class.

It is necessary for this class to match the one used in the jQuery code snippet, which you will find later on in this tutorial. For our examples, we made one button module with the class “pa-button-icon-right” and another button module with the class “pa-button-icon-left” which allows us to target them properly. We use custom classes to make sure that our custom code will not affect the element that we don’t want to change.

Turn Off The Default Button Icon

By default, the Divi Button module has an icon that is turned on by default when you hover over the module. Since we do not want the default icon, we need to first turn off the icon. To do this, go to the Button module settings to the Design tab to the Button toggle and turn on “Use Custom Styles For Button.” Scroll down there and look for the “Show Button Icon” setting and turn it off.

turn off default Divi button icon

Use jQuery To Add A Font Awesome Icon

The next step is to add the icon of your choice from Font Awesome. You can choose the actual icon in the next step, but first, we need to use a jQuery snippet with an example icon included to get you started.

Notice there are two similar but different snippets. One adds the icon to the right, the other adds the icon to the left. It’s your choice, just choose one and make sure to match the CSS class in the module from the previous step.

If you are using our free Divi child theme, place this snippet into the scripts.js file and remove the <script> tags at the beginning and end. Otherwise, place this in your Divi>Theme Options>Integrations tab in the “Add code to the < head > of your blog” code area.

Add JQuery For Font Awesome Icon On The Right

jQuery(document).ready(function () {
    jQuery(".pa-button-icon-right").append("<span><i class='fas fa-bacon'></i></span>");

Add JQuery For Font Awesome Icon On The Left

jQuery(document).ready(function () {
    jQuery(".pa-button-icon-left").prepend("<span><i class='fas fa-bacon'></i></span>");

Choose Your Font Awesome Icon

Now you can choose your own icon from the thousands of them that are available on the Font Awesome website. The only part of this snippet that you should change is between the <span> tag. Notice in this example the icon code copied from Font Awesome is <i class=’fas fa-bacon’></i>.

Where To Find The Icon Code?

To find this code, go to the Font Awesome website and find the icon that you want to use. From there you will see the HTML code and you can just click to copy it.

choosing the icon code on Font Awesome.png

So just place that between the <span> tags and you are all done!

NOTE: I ran into a weird issue where the double quote symbols (“) were not working, I had to change them to single quote apostrophe symbols (‘). Not sure if that was just me or what, but try that if you have trouble with it. 

Add Spacing And Style The Icons

At this point the icons are smack up against the button text, and that’s not cool. So now we just need to add one of CSS to move them over. Notice how each snippet below corresponds to whichever CSS class you were using so far, either left or right, so choose the one that matches.

Now of course you probably want to make the icons look good. Since we are not using the default icons, we can’t just use the design settings in the module. You will need to sue CSS for this. You can target the icon like this example:

If you are using our free Divi child theme, place this snippet into the style.css file. Otherwise, place this in your Divi>Theme Options>Custom CSS code box. If you need help, check out our complete guide on Where To Add Custom Code In Divi.

Add CSS For Font Awesome Icon On The Right

/*position and style Font Awesome icon on the right*/

.pa-button-icon-right span {
    margin-left: 14px;
    /*your styles here*/

Add CSS For Font Awesome Icon On The Left

/*position and style Font Awesome icon on the right*/

.pa-button-icon-left span {
    margin-right: 14px;
    /*your styles here*/

Repeat This Process For Each Button

If you want to do this for more than one blurb, no problem! You will just repeat some of the steps for each one. Make sure to assign a different unique class to each blurb module, and them make sure you update that class in the duplicate jQuery snippet.

Hover Option

There is unfortunately no good way to make a nice smooth hover option when using this method. However, I will give you an example of how this can work. It works fine, it is just not a smooth transition because you can’t add transition effects to the display attribute. 

In these snippets you can see that I first hide the icon, then when hovering over the button the are shown. You can play around with these as you want. I’ll also show these in action in the video, so be sure to watch that.

Hover For Icon On Right

.pa-button-icon-right span {
	margin-left: 14px;
	display: none;

.pa-button-icon-right:hover span {
	display: inline-block;

Hover For Icon On Left

.pa-button-icon-left span {
	margin-right: 14px;
	display: none;

.pa-button-icon-left:hover span {
	display: inline-block;

Subscribe For More Things Like This!

At the start of each month, we send out a recap newsletter from the month before with family news, Divi news, our latest tutorials, and product news. Occasionally, if the news is too exciting to wait, we will send out another email separate from the monthly newsletter. That’s what you get when you subscribe, and of course you can unsubscribe if you are no longer interested!

Blog Post Optin
Divi Logo (2)

Shop Our Divi Products

Plugins • Courses • Templates

Visit The Shop

Featured Products

Asset 4

New! Trail Guides

Follow a series of blog posts carefully arranged around a specific topic or goal! Keep track of your progress by marking posts completed, just like a free course!

View Trial Guides

Divi Trail Committee Membership badge with map design

Join The Trail Committee!

Show support for our ongoing work creating community resources at Pee-Aye Creative and enjoy exclusive member perks in return.

Learn More

Divi Tutorials On YouTube

Our videos have views! Join subscribers and enjoy over video tutorials!

Visit Our Channel

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy


Comments By Others

  1. Explodedstarmonkey

    Thanks for this,
    With the regular button icon i can use line-height to adjust the icons vertical alignment with the button text, how would you do that here?

    • Hemant Gaba

      Hi there!

      The icon should be aligned by default. Could you please share the URL of the page for me to investigate further?

  2. Joshua Riggs

    Great stuff as always.

    Question – what are the steps to add a custom icon to a button, instead of a font-awesome icon?

    • Hemant Gaba

      I guess we need to use a jQuery code to achieve this.


Submit a Comment

Your email address will not be published. Required fields are marked *

Recent Posts


Your Cart