Forminator is our favorite WordPress forms plugin. Follow these steps to create a responsive 1-Line Opt-In Form using Forminator.
View An Example Of The Solution Here
- Login to your WordPress site admin.
- Go to Forminator Pro > Forms
- Click to Create a form.
- Select the Blank template and click the Continue button (bottom-right).
- Click Insert Fields.
- Select both Email and Hidden Field then click the Insert Field button (bottom-right).
- Click the Email field, then enter “Email” into the Label field.
- Delete/Remove text in the Placeholder field.
- Click the Settings tab (for the Email field).
- Click the Required tab under the Require section.
- Enter “Email” is required. into the Error message field.
- Click the Validate Field tab under the Validate section.
- Enter “You must enter a valid email address.” in to Validation message field.
- Click the Apply button (bottom-right).
- Click the Hidden Field.
- Enter Source into the Label field.
- Select Custom Value on the Default Value menu.
- Enter a value into the Custom Value field. We used newsletter-opt-in for this example to specify that this opt-in was specifically for newsletter subscriptions.
- Click the Apply button (bottom-right).
- Click the Appearance link (left-side-menu).
- Click the Flat tab under the Design Style section.
- Click the Custom tab under the Colors section to edit form and form button colors. We use these settings to customize form button colors for example.
- Click the Custom tab under the Fonts section to edit form font styles. We use these settings to customize field label and button font styles for example.
- Click Enable custom CSS under the Custom CSS section.
- Copy the custom CSS code below and paste it into the Custom CSS field.
- Click the Update button (top-right) to save your edits.
- Click the Preview button (top-right) to preview the form.
Custom CSS Code
Use the code below to complete Step 25 (above).
Forminator has a “Page Break” module that can be inserted into a form to break form content into separate “page” steps. This feature can be used to create Typeform style paginated surveys.
The code below styles the form and submit button to appear on 1-line. The code is responsive so the form breaks onto 2-lines on smaller screens (mobile phones). It works with Forminator Page Break forms. It also features code that removes the shadow on form “Submit” buttons and on “Back,” and “Next” buttons that appear on form break screens.
The CSS Code:
/* Hide Email Field Label */
label.forminator-label {
display: none;
}
/* Create 1-Line Form + Set Email Field Width On Large Screens */
@media (min-width: 783px) {
div.forminator-row, div.forminator-row forminator-row-last {
float: left;
}
div.forminator-row {
width: 40%;
}
}
/* Set Email Field Width On Small Screens */
@media (max-width: 783px) {
div.forminator-row {
width: 100%;
}
}
/* Hide Drop Shadow On From Buttons */
button.forminator-button.forminator-button-submit, button.forminator-button.forminator-button-next, button.forminator-button.forminator-button-back {
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
/* Set Field Error Messages Line Height */
span.forminator-error-message {
line-height: 1.2em !important;
}
Enjoy!
Recent Comments