Slim Divi Optin Form Module Layout

aniaromanska

Written by Ania Romańska

Published on . Last edited on .

Slim Divi Email Optin form layout

TL;DR

Add the CSS class dl-slim-optin1 (email only), dl-slim-optin2 (name + email) or dl-slim-optin3 (first name, last name + email) to a Divi Email Optin module and paste the matching CSS.

In Divi 5 the fields wrapper .et_pb_newsletter_fields is a vertical flex container, so the CSS needs flex-direction: row and column-gap: 0 to keep the fields in one line.

In Divi 5 the Email Optin form is only rendered when an email account and list are selected in Content → Email Account.

Divi 5 class path: Advanced → Attributes → Add Attribute → CSS Class (Divi 4: Advanced → CSS ID & Classes).

On phones (below 480px) every field and the button take 100% width, so the form stacks again.

Updated for Divi 5: In Divi 5 the Email Optin fields are stacked in a vertical flex column, so the original CSS no longer put them in one line. The CSS below has three small additions for Divi 5 (tested on a Divi 5 site) and still works in Divi 4.

How to make a slim Divi Email Optin form

Give the Email Optin module a custom CSS class and add a few lines of CSS that put the input fields and the Subscribe button in one row. You get a thin, horizontal signup bar instead of the tall default form, and it still stacks nicely on phones.

A while ago Divi introduced a new HTML markup for its Optin Module, and previously custom-styled forms stopped looking the way you'd like. In this quick tutorial I'd like to show you what CSS you can use to change the default Optin Form into a thinner and cooler version.

The video was recorded in an older Divi version. The idea is the same in Divi 5, but use the updated CSS from this post, and add the class in Advanced tab ➜ Attributes ➜ Add Attribute ➜ CSS Class (Divi 4: Advanced tab ➜ CSS ID & Classes ➜ CSS Class).

Here is how to use the snippets below:

  1. Add an Email Optin module to a one-column (full-width) row.
  2. In Content tab ➜ Email Account, choose your email provider and the list. In Divi 5 the form is not shown on the page until an account and a list are selected, so do this first.
  3. In Content tab ➜ Fields, choose the fields you want: email only, a single name field (Use Single Name Field) or first and last name.
  4. Add the matching CSS class (dl-slim-optin1, dl-slim-optin2 or dl-slim-optin3) in Advanced tab ➜ Attributes ➜ Add Attribute ➜ CSS Class (Divi 4: Advanced tab ➜ CSS ID & Classes ➜ CSS Class).
  5. Paste the CSS in Divi ➜ Theme Options ➜ General ➜ Custom CSS, in the page settings (Divi 5: gear icon top-left ➜ Page Settings ➜ Advanced ➜ Custom CSS) or in your child theme stylesheet.

Divi 5 also has a Fullwidth toggle for each field (Design tab ➜ Layout), which can put two fields side by side, but the button always gets its own line. For a true one-line form you still need the CSS.

Please note: I'm not a lawyer so this is not legal advice, BUT you don't need any checkboxes to make your signup form GDPR compliant. You need the subscriber's explicit consent to send them emails, but a checkbox is not the only way to get this consent. Use your header and a phrase like "Subscribe to" to make sure it's clear that the user is consenting to a newsletter by signing up.

1. Slim signup form with single input field

For an email-only form, add the CSS class dl-slim-optin1: the email field and the button share one line (49% each), and the privacy text sits underneath.

Slim Divi Email Optin form with one email field and the button in one line

If you are going to use a single e-mail field in your optin form, add a custom CSS class of dl-slim-optin1 and use this CSS code:

/* Divi 5: keep the fields in one row (no effect in Divi 4) */
.dl-slim-optin1 .et_pb_newsletter_fields {
	flex-direction: row;
	column-gap: 0;
}
.dl-slim-optin1 .et_pb_newsletter_footer {
	flex-basis: 100%;
	margin-top: 0;
	font-size: 80%;
}	
.dl-slim-optin1 .et_pb_newsletter_form .et_pb_newsletter_field,
.dl-slim-optin1 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
	flex-basis:49%;
}
@media (max-width:980px) {
	.et_pb_column_4_4 .dl-slim-optin1 {
		display:block;
	}
	.dl-slim-optin1 .et_pb_newsletter_description,
	.dl-slim-optin1 .et_pb_newsletter_form {
		width: 100%;
		padding: 0;
	}
	.et_pb_column_4_4 .dl-slim-optin1 .et_pb_newsletter_description {
		margin-bottom: 10px;
		text-align:center;
	}
	.dl-slim-optin1 .et_pb_newsletter_footer {
		text-align:center;
	}
}
@media (max-width:479px) {
	.dl-slim-optin1 .et_pb_newsletter_form .et_pb_newsletter_field,
	.dl-slim-optin1 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
		flex-basis:100%;
	}
}

2. Slim signup form with two input fields

For a name + email form, add the CSS class dl-slim-optin2: on desktop the title takes 30% of the width and the name field, email field and button share the other 70%.

Slim Divi Email Optin form with name and email fields in one line

If you are going to use both e-mail and name field in your optin form, add a custom CSS class of dl-slim-optin2 and use this CSS code:

/* Divi 5: keep the fields in one row (no effect in Divi 4) */
.dl-slim-optin2 .et_pb_newsletter_fields {
	flex-direction: row;
	column-gap: 0;
}
@media (min-width:981px) {
	.et_pb_newsletter.dl-slim-optin2 .et_pb_newsletter_description {
		width: 30%;
	}
	.et_pb_newsletter.dl-slim-optin2 .et_pb_newsletter_form {
		width:70%;
	}
}
.dl-slim-optin2 .et_pb_newsletter_form .et_pb_newsletter_field,
.dl-slim-optin2 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
	flex-basis:32.5%;
}
.dl-slim-optin2 .et_pb_newsletter_footer {
	margin-top:0;
}
.dl-slim-optin2 .et_pb_module_header {
	padding-bottom:0; 
}
@media (max-width:980px) {
	.et_pb_column_4_4 .dl-slim-optin2 {
		display:block;
	}
	.dl-slim-optin2 .et_pb_newsletter_description,
	.dl-slim-optin2 .et_pb_newsletter_form {
		width: 100%;
		padding: 0;
	}
	.et_pb_column_4_4 .dl-slim-optin2 .et_pb_newsletter_description {
		text-align:center;
		margin-bottom:10px;
	}
	.dl-slim-optin2 .et_pb_newsletter_footer {
		text-align:center;
	}
}
@media (max-width:600px) {
	.dl-slim-optin2 .et_pb_newsletter_form .et_pb_newsletter_field {
		flex-basis:49%;
	}
	.dl-slim-optin2 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
		flex-basis:100%;
	}
}
@media (max-width:479px) {
	.dl-slim-optin2 .et_pb_newsletter_form .et_pb_newsletter_field{
		flex-basis:100%;
	}
}

3. Slim signup form with three input fields

For first name, last name and email, add the CSS class dl-slim-optin3: the title goes on top and the three fields and the button share one line (24.5% each), two per line below 800px and one per line on phones.

Slim Divi Email Optin form with first name, last name and email fields in one line

If you are going to use all of the default Divi Optin Module fields: first name, last name and e-mail field in your optin form, add a custom CSS class of dl-slim-optin3 and use this CSS code:

/* Divi 5: keep the fields in one row (no effect in Divi 4) */
.dl-slim-optin3 .et_pb_newsletter_fields {
	flex-direction: row;
	column-gap: 0;
}
.dl-slim-optin3 .et_pb_newsletter_form .et_pb_newsletter_field,
.dl-slim-optin3 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
  flex-basis:24.5%;
}
.dl-slim-optin3 .et_pb_newsletter_footer {
  margin-top:0;
}
.et_pb_column_4_4 .dl-slim-optin3 {
  display:block;
}
.dl-slim-optin3 .et_pb_newsletter_description,
.dl-slim-optin3 .et_pb_newsletter_form {
  width: 100%;
  padding: 0;
}
@media (max-width:800px) {
  .dl-slim-optin3 .et_pb_newsletter_form .et_pb_newsletter_field,
  .dl-slim-optin3 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
    flex-basis:49%;
  }
  .et_pb_column_4_4 .dl-slim-optin3 .et_pb_newsletter_description {
    margin-bottom:10px;
  }
}
@media (max-width:479px) {
  .dl-slim-optin3 .et_pb_newsletter_form .et_pb_newsletter_field,
  .dl-slim-optin3 .et_pb_newsletter_form .et_pb_newsletter_button_wrap {
    flex-basis:100%;
  }
}

What changed in the CSS for Divi 5

Three things, all harmless in Divi 4:

  • flex-direction: row on .et_pb_newsletter_fields. Divi 5 renders the fields wrapper as a flex container with a vertical direction, so without this line every field and the button sit under each other. column-gap: 0 removes the 15px gap Divi 5 adds, otherwise two 49% items no longer fit in one line.
  • Stronger field selectors. On tablet and phone Divi 5 sets flex-basis: 100% on the last field with a three-class selector, so the snippets now say .dl-slim-optin1 .et_pb_newsletter_form .et_pb_newsletter_field instead of .dl-slim-optin1 .et_pb_newsletter_field.
  • The 30/70 split of the two-field version now uses .et_pb_newsletter.dl-slim-optin2, because Divi 5 sets the title and the form to width: 100% with a stronger selector.

If you added the old CSS to a site and moved it to Divi 5, replace it with the new version and the forms will be slim again.

Download the free Slim Optin layout

The layout has all three slim forms, each with its CSS in a Code module, so you can import it and pick the one you like. You can also see them on the live preview page.

Free download

Slim Email Optin Forms Layout

Three slim one-line Divi Email Optin forms (email only, name + email, first + last name + email) with their CSS in Code modules. Works in Divi 5 and Divi 4.

Get the free download

After the import, open each Email Optin module and select your own email account and list (Content tab ➜ Email Account). Divi 5 shows the form only after that. Have a question? Ask in my Divi Lovers Facebook group.

This article has been tagged with: Divi 5, Divi CSS

Tags

Slim Divi Email Optin form layout

Table of Contents

Popular questions

Why is my Divi 5 Email Optin form not showing on the page?

Divi 5 renders the form only when an email provider account and a list are selected in the module (Content tab → Email Account). Without them you only see the title and the description. This also applies to layouts you import, so connect your own account after the import.

Why are the optin fields stacked in Divi 5 even with the old CSS?

Divi 5 makes .et_pb_newsletter_fields a flex container with a vertical direction and a 15px gap. Add flex-direction: row; and column-gap: 0; to it, as in the updated snippets in this post.

Can I make the optin form one line without CSS in Divi 5?

Only partly. Divi 5 has a Fullwidth toggle for each field in Design → Layout, which puts two fields side by side, but the button always takes its own line. For fields and button in one line, use the CSS from this post.

Do I need a checkbox to make the signup form GDPR compliant?

Not necessarily (and this is not legal advice). You need the subscriber's explicit consent, and a clear heading like "Subscribe to…" can make it obvious that signing up means joining a newsletter. Check the rules that apply to your business.

About the Author

Ania Romańska

I'm a Divi expert from Poland, with over 10 years building the templates and courses that make up Divi Lover. I'm also a mom of five, which taught me a thing or two about explaining things clearly the first time.

Hey there!Sorry to interrupt,but this one's important!

Divi Lover is turning 10!
Let’s celebrate with 40% off everything.

Ten years of Divi templates, plugins and tips, and a brand-new website to celebrate it. To say thank you, every product in the shop is 40% off until Cyber Monday.

Your code

Paste it at checkout. Valid until November 30.