Add Icons to Divi Contact Form Fields

Written by Dan Mossop

In web design, sometimes it's the small touches that make a big difference. In this guide, I'll show you how to add icons to the fields in a Divi contact form. Here's how it will look:

For this, we can use some CSS to add icons from the ETModules icon set that's built into Divi. Here's how to do it:

/* === Add contact form placeholder icons === */
/* - see: https://divibooster.com/add-icons-to-divi-contact-form-fields/ */
/* - icon codes from https://www.elegantthemes.com/blog/resources/elegant-icon-font */

.et_pb_contact_form p[data-id]:before {
    font-family: 'ETModules' !important;
    position: absolute;
    z-index: 1;
    font-size: 16px;
    padding: 15px;
    color: green;
}
.et_pb_contact_form p[data-id] input,
.et_pb_contact_form p[data-id] textarea,
.et_pb_contact_form p[data-id] select {
    padding-left: 46px !important;
}
.et_pb_contact_form p[data-id="name"]:before {
    content: "\e08a" !important;
}
.et_pb_contact_form p[data-id="email"]:before {
    content: "\e010" !important;
}
.et_pb_contact_form p[data-id="phone"]:before {
    content: "\e00b" !important;
}
.et_pb_contact_form p[data-id="message"]:before {
    content: "\76" !important;
}
.et_pb_contact_form p[data-id="subject"]:before {
    content: "\7c" !important;
}
.et_pb_contact_form p[data-id="topic"]:before {
    content: "\e018" !important;
}

This CSS will add icons from the ETModules font before each input field, next to the placeholder text. Each field has its own appropriate icon: a person for the name, an envelope for the email, a phone for the phone number, and a speech bubble for the message.

Apply this to only certain contact forms, give these contact form a CSS class and replace "et_pb_contact_form" in the code with this CSS class.

To target other fields, change the data-id values to the IDs of the fields set in your contact form module settings.

If the icons don't show up right away, you might need to disable dynamic icons at:

Divi > Theme Options > General > Performance > Dynamic Icons

By following these steps, you should have a more visually appealing and universally understandable contact form.

Enhance Your Divi Experience with Icons

Easily add meaningful icons to your contact forms using ETModules icons, as laid out in our step-by-step guide. Make your forms more intuitive and visually engaging without extra plugins.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

4 Comments

  1. I am thinking of buying Divi Booster during the Black Friday sale. If I use the method above (or a similar method) could I use a custom icon at the beginning of each field if I am using Divi Booster?

    Thank you so much

    Reply
    • Hey Will, currently this wouldn't work as the Divi Booster lets you upload icons as images, while the code above is using Divi's icon font (where the icons are really text with a specially designed font). But it would be a nice feature to add in Divi Booster and I can see how it could be done, so I've filed a feature request to look into this and will let you know if / when I'm able to implement it. Thanks!

      Reply
      • I am definitely going to pick up Divi Booster in the next few days anyway. But do you think it would be possible to modify this approach to use images directly for the :before rather than the font icons?

        Reply
        • It should be, yeah. I think it would work if you set the image as a CSS background-image on the :before and set a width / height on it too. You might have a bit of playing around with positioning, etc, but I imagine it would work out. I'm out of town for a few days but I'll try to spend a bit of time on this when I'm back at my desk and hopefully be able to give you a more specific answer. Thanks again!

          Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

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

We may earn a commission when you visit links on our website.

Latest From Divi Booster

Enable Automatic Looping for YouTube Videos in the Divi Video Module

Enabling automatic looping for YouTube videos in your Divi video module ensures that content plays seamlessly and continuously without interruption. This feature can enhance user engagement, highlight key information, or create dynamic visual effects on your website....

Hide Video Controls in Divi Video Module

Disabling YouTube video controls in the Divi Video Module helps create a seamless, distraction-free viewing experience for your site visitors. This approach is useful when you want full control over how your video content appears and is interacted with on the page, or...

Mute YouTube Videos by Default in the Divi Video Module

In the Divi Video Module, starting your YouTube videos muted by default can create a more user-friendly browsing experience on your webpage. It is particularly beneficial for reducing distractions, enhancing visitor engagement, and providing a seamless content preview...

Autoplay Videos in Divi Video Module

Enabling videos in your Divi video module to start playing automatically can enhance both the site's design and user engagement. To ensure full compatibility with browser requirements, such as Chrome's autoplay policy, it's often necessary to start your videos muted...

How to Add the Post Status in Divi's Dynamic Content

Divi's Dynamic Content feature is great for enhancing your post/page templates with post-specific information. While Divi includes an option to show information such as the Post Created Date using Dynamic Content, there is no equivalent option for the Post Status....

Random Divi Posts