How To Create A Single Field Divi Email Optin Module Tutorial by Pee Aye Creative.jpg

How To Create A Single Field Divi Email Optin Module

This tutorial will show you how to style and customize the Divi Email Optin module and make a horizontal single field optin layout for your email signups!
Categories: Divi CSS Tutorials

Join subscribers on our YouTube channel and enjoy other Divi video tutorials!

Style & Customize The Divi Email Optin Module

To begin, style the Divi Email Optin module however you want using the design settings. You can design the input fields and button using all the available Divi settings. The main benefit to this tutorial is not how to do that, since those are all standard Divi Builder features, but rather it is the CSS that makes this all work together beautifully which will be added in the next step.

Toggle Off The Email Optin Fields

There are only a few steps that are required, and they are very easy. First, go in the module settings and turn off all the toggles for the name fields. The screenshot below shows how this will look when you are done with that.

Turn off all the field settings in the Divi Email Option module

Set The Email Optin Layout

Next, be sure to set the layout to “Body On Top, Form On Bottom” for this to work well. This is the last required step, so go ahead and any other design adjustments and proceed to the CSS snippet below.

Divi email optin module layout for making horizontal single field

Add CSS To Make The Divi Email Optin Inline Horizontal

Now that we have the module set up, it’s time to add the CSS that does the tricks we need it to do. 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.

@media (min-width: 767px) {
	/*set the width of the input fields minus the width of the button*/
	.et_pb_newsletter_fields .et_pb_newsletter_field {
		flex-basis: calc(100% - 225px) !important;
	}
	/*set the width of the button*/
	.et_pb_newsletter_fields .et_pb_newsletter_button_wrap {
		flex-basis: 210px !important;
	}
}

Media Query

You’ll notice a couple of things are happening here. First of all, the entire snippet of code is wrapped in a media query. The purpose of that is to allow the optin module to change to a stacked layout on screens smaller than 767px.

Learn More About Media Queries

Input Field Width

The first part of the code makes the input field area 100% wide, but we are using a CSS trick to calculate 100% minus the width of the button.

Button Width

The next part of the code is setting the width of the button. Notice how there is a difference in the pixel value. The reason for that is to allow space for the gap between the email field and the button.

Single Field Horizontal Divi Email Optin Module Examples

Like I said at the beginning, I like to use these on our child themes and on client sites. So I thought I would inspire you by showing you some of the designs I have used.

Divi LMS Child theme single field email optin example
Divi Photographer Child theme single field email optin example
Divi Mowing Child theme single field email optin example
Divi Storefront Child theme single field email optin example
28

Last updated Aug 31, 2021 @ 11:23 am

Subscribe

Each month we send out a roundup email newsletter with the latest tutorials, product updates, helpful resources, and any other industry or personal news. Occasionally we send an extra separate email here and there if we just can’t wait! So that’s what you will get if you subscribe, and you can always unsubscribe at any time if you just can’t take it anymore :)

Please share this post!

Nelson Lee Miller (aka The Divi Teacher)

Nelson is the owner of Pee-Aye Creative in the beautiful state of Pennsylvania. He loves helping small businesses, exploring outdoors, building websites with Divi, and teaching others.

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

16 Comments

  1. zafar

    realy help full thank you

    Reply
  2. Rufayl

    Hey Nelson, I have a problem with this, it is showing this at the backend but not on the front end dont know why?
    https://vipsolutions.org/

    Reply
    • Nelson Lee Miller (aka The Divi Teacher)

      Hi Rufayl,
      That sounds like you have not connected the email optin to an email provider, such as Mailchimp. This is just a Divi thing, Once you do that it shows.

      Reply
      • Kay

        Hi, Nelson, great tutorial! Wondering about adding a name field for the horizontal layout. Love this and have started using it.

      • Nelson Lee Miller (aka The Divi Teacher)

        Hi Kay,
        Yes just adjust the width in the CSS, you can try this:

        @media (min-width: 980px) {

        /*set the width of the input fields*/
        .et_pb_newsletter_field {
        flex-basis: 39% !important;

        }

        /*set the width of the button*/
        .et_pb_newsletter_button_wrap {
        flex-basis: 20%!important;
        }
        }

  3. Philipp

    Hi Nelson,

    do you know how to have a name field which is optional?
    Divi only offers a name field which is required, but that is in direct conflict with GDPR.

    Would love to see your take on this.

    At the moment we solve it using gravity forms / contact form 7 , but for small project it would be amazing to use the divi optin module.

    Cheers from Germany,
    Philipp

    Reply
    • Nelson Lee Miller (aka The Divi Teacher)

      Hi Philipp,
      That’s an interesting question that I never considered. You are right, they don’t have any way to set it as required or optional like they do with the Contact Form module. I’m not sure, but that may be a good thing to ask Elegant Themes to consider!

      Reply
  4. Ali

    Thanks Alot Sir

    Reply
  5. Kathryn Kohm

    Hello, works beautifully by itself….but when I add custom fields, the alignment is thrown off (see screenshot). Any suggestions?

    Reply
  6. Phil Simon

    This. Is. Awesome. Thanks, Nelson. You freakin’ rock.

    Reply
  7. Tim Williams

    Hey Nelson. Thank you for the tutorial.

    Question:

    Is there a way to tell Divi to only apply this layout for one specific email opt in form? I’m trying to create another without the layout effects.

    Thank you

    Reply

Submit a Comment

Your email address will not be published.

Recent Posts

Pin It on Pinterest

0

Your Cart