Gravity Forms is a powerful tool for creating custom forms, but its default styling can be, well, a bit bland. Fortunately, with a bit of CSS magic, you can transform your forms into sleek and modern masterpieces.
To get started, you can use the pre-defined CSS classes provided by Gravity Forms, such as the `.gform_wrapper` class, which styles the form container. By adding custom CSS rules, you can override these styles and create a unique look for your forms.
For example, you can use the `.gform_wrapper` class to change the background color of your form by adding a CSS rule like `.gform_wrapper { background-color: #f2f2f2; }`. This simple tweak can make a big impact on the overall design of your form.
Version Specificity
Gravity Forms CSS styling can be a bit tricky, especially when it comes to version specificity.
In Gravity Forms 2.5 and later, or older forms with the enable legacy markup setting turned off, you'll need to use "standard markup" to target your forms.
The good news is that this change is relatively straightforward. You can use the same markup you've been using all along, and it will work just fine.
However, if you're using a version of Gravity Forms prior to 2.5, or if you have the enable legacy markup setting turned on, you'll need to use "legacy markup" to target your forms.
Here are the different types of markup you can use, depending on your version:
- Legacy markup: targeting for Gravity Forms versions prior to 2.5, or forms with the enable legacy markup setting turned on.
- Standard markup: targeting needed for forms created under Gravity Forms 2.5 and later, or older forms with the enable legacy markup setting turned off.
This means you'll need to choose the right markup depending on your form's version.
Styling Basics
Gravity Forms does a great job of inheriting your theme's default styles, but there's room to make your forms shine even brighter. This means you can customize the confirmation message, highlight alerts, and even change the text styling in certain areas of your form.
You can use Ready Classes to change text styling in Gravity Forms, which can be applied to specific areas like customizing the confirmation message or highlighting alerts in the form text.
Customizing your forms is a proven tactic to create a seamless, professional, and memorable experience for your customers while maximizing the effectiveness of your online forms.
There are four primary methods for styling your Gravity Forms without requiring any additional plugins or tools: using the Gravity Forms Editor, Form Themes, CSS Ready Classes, and custom CSS.
The Gravity Forms Editor provides a user-friendly way to make simple adjustments to your forms without the need for advanced coding skills. This includes changing the style/layout of list items in field types like checkboxes or radio buttons.
You can also use Form Themes to style your forms directly from the WordPress block editor without the need for custom CSS snippets. The Orbital form theme offers built-in block styling options, allowing users to modify various elements such as color schemes, background colors or background images, submit button styles, input sizes, and more.
Here are some common Ready Classes you can use to make quick and easy adjustments to your forms:
These Ready Classes will help you separate the list items in fields like Checkboxes and Radio Buttons into multiple columns, making it easier for your users to navigate your forms.
To make changes to your forms using CSS Ready Classes, follow these steps: Open field settings, add Ready Classes under the Appearance tab, and enter the relevant Ready Class in the Custom CSS Class field.
Form Elements
Form elements are the building blocks of your Gravity Forms, and styling them can make a big difference in the overall user experience. You can use CSS to customize the appearance of individual form elements, such as fields and labels.
To style a specific form element, you can use a CSS selector that targets the element's parent element ID. For example, to add a red border to a specific drop-down field, you would use the CSS selector `body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield select`.
Here are some examples of CSS selectors you can use to target different form elements:
By using these CSS selectors, you can customize the appearance of individual form elements and create a more polished and professional-looking form.
Form Elements" would most likely fall under "Required Indicator (Asterisk)
You can customize the required field indicator to make it stand out to your users. You can change the color of the required field indicator to red by adding the following CSS code: body .gform_wrapper .gform_body .gform_fields .gfield .gfield_label .gfield_required {color: red}.
This code applies to all forms on your website. If you want to apply it just to form ID #1, you can use the following code instead: body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_label .gfield_required {color: red}.
If you want to apply it just to a specific field, you can use the following code: body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_label .gfield_required {color: red}. Just replace "XX_X" with the actual ID of the field you want to target.
Here are some examples of how you can customize the required field indicator:
Remember, you can always adjust the color and style of the required field indicator to fit your website's design.
Drop Down Select
Drop Down Select is a versatile form element that can be customized to suit your needs.
You can apply a style to all drop-down fields in your form by targeting the .gfield select class. For example, you can add a red border to all drop-down fields by adding the following CSS code: body .gform_wrapper .gform_body .gform_fields .gfield select {border: 1px solid red}
If you want to apply a style to a specific drop-down field, you can target it by its form ID. For example, if you want to add a red border to the drop-down field in form ID #1, you can use the following CSS code: body #gform_wrapper_1 .gform_body .gform_fields .gfield select {border: 1px solid red}
You can also target a specific drop-down field by its unique parent element ID. For example, if you want to add a red border to a specific drop-down field with the ID #field_XX_X, you can use the following CSS code: body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield select {border: 1px solid red}
Paragraph (Textarea)
The paragraph (textarea) field is a standard form element that can be styled in various ways. You can target all forms on your website by using the CSS selector `body .gform_wrapper .gform_body .gform_fields .gfield textarea`.
To apply styles just to form ID #1, you can use the CSS selector `body #gform_wrapper_1 .gform_body .gform_fields .gfield textarea`. This will add a red border to the textarea field in the specified form.
You can also target a specific paragraph field by using the CSS selector `body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield textarea`. Here, replace "XX_X" with the actual ID of the paragraph field you want to target.
The key is to understand how to use CSS selectors to target specific form elements. By using the correct selector, you can apply styles to the paragraph field without affecting other form elements on your website.
Multiple Choice (Radio)
You can also target specific Multiple Choice (Radio) list items using the following code: example: standard multiple-choice list item (div) – applies to all standard markup forms body .gform_wrapper .gform_body .gform_fields .gfield .gfield_radio .gchoice {border: 1px solid red}example: standard multiple-choice list item (li) – applies to all forms using legacy markup body .gform_wrapper .gform_body .gform_fields .gfield .gfield_radio li {border: 1px solid red}
To target specific Multiple Choice (Radio) inputs, you can use the following code: example: standard multiple-choice input (radio) – applies to all forms body .gform_wrapper .gform_body .gform_fields .gfield .gfield_radio input[type=radio] {border: 1px solid red}
Multiple Choice (Radio) inputs can be targeted by form ID, using code like: example: standard checkbox input (radio) – applies just to form ID #1 body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_radio input[type=radio] {border: 1px solid red}
Here are some examples of how to target specific Multiple Choice (Radio) inputs:
Checkbox
Checkboxes are a versatile form element that can be styled in various ways to suit your form's design.
You can apply a standard checkbox list style to all forms by adding the following CSS code to your stylesheet: body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox {border: 1px solid red}.
To target a specific form, you can modify the CSS selector to include the form's ID, like this: body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_checkbox {border: 1px solid red}.
If you want to style a specific checkbox list within a form, you can use the unique parent element ID, like this: body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_checkbox {border: 1px solid red}.
Checkbox inputs can also be styled in a similar way. For example, to apply a standard checkbox input style to all forms, use the following CSS code: body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox input[type=checkbox] {border: 1px solid red}.
To target a specific form or checkbox list, you can modify the CSS selector as needed.
Here are some examples of how to style checkbox lists and inputs:
Checkbox list items can also be styled, and there are different ways to do it depending on the form's markup. For example, to apply a standard checkbox list item style to all forms using standard markup, use the following CSS code: body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox .gchoice {border: 1px solid red}.
Telephone (Html 5)
Telephone (Html 5) is a crucial form element that allows users to input their phone numbers. It's a simple yet effective way to collect phone numbers from users.
You can apply CSS styles to the telephone input field using the HTML 5 option. For example, you can add a red border to the field by adding the following code to your CSS: body .gform_wrapper .gform_body .gform_fields .gfield input[type=tel] {border: 1px solid red}
The telephone input field can be targeted specifically to a form ID. For instance, if you want to apply the style to form ID #1, you would use the following code: body #gform_wrapper_1 .gform_body .gform_fields .gfield input[type=tel] {border: 1px solid red}
You can also target a specific telephone field by using the unique parent element ID. This is useful when you have multiple telephone fields on the same form. For example, if the ID of the parent element is "field_XX_X", you would use the following code: body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield input[type=tel] {border: 1px solid red}
Really Simple Captcha
Really Simple Captcha is a great way to add an extra layer of security to your forms. It's really simple to use, as the name suggests!
You can apply a Captcha image to all forms on your website by using a CSS selector like body .gform_wrapper .gform_body .gform_fields .gfield .gfield_captcha_container .gfield_captcha {border: 1px solid red}. This will add a red border to the Captcha image on every form.
If you only want to apply the Captcha image to a specific form, you can use a CSS selector like body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_captcha_container .gfield_captcha {border: 1px solid red}. This will add a red border to the Captcha image on form ID #1.
You can use different CSS selectors to apply styles to your Captcha images, depending on your needs.
Submit Button
The submit button is a crucial element in any form, and styling it can greatly enhance the user experience. You can target the submit button using CSS selectors.
For a standard form submit button, you can use the following selector: `body .gform_wrapper .gform_footer input[type=submit]`. This will apply the styles to all forms on your website.
If you want to style the submit button for a specific form, you can use the form ID in the selector, like this: `body #gform_wrapper_1 .gform_footer input[type=submit]`. This will apply the styles only to form ID #1.
The submit button can also be styled as an image, and the selector for this would be: `body .gform_wrapper .gform_footer input[type=image]`. Again, you can use the form ID to target a specific form.
Here's a summary of the submit button selectors:
By using these selectors, you can easily style the submit button to match your website's design and enhance the user experience.
Progress Bar
The progress bar is a crucial element in forms, providing a visual representation of the user's progress. It's a great way to keep users engaged and motivated throughout the form-filling process.
You can customize the progress bar container to apply to all forms by targeting the `.gform_wrapper .gf_progressbar_wrapper` class. For example, you can add a red border to the progress bar container by adding the following CSS rule: `body .gform_wrapper .gf_progressbar_wrapper {border: 1px solid red}`.
If you want to apply the progress bar container style to a specific form, you can target the form ID by adding the `#gform_wrapper_1` class. For instance, to add a red border to the progress bar container of form ID #1, you can use the following CSS rule: `body #gform_wrapper_1 .gf_progressbar_wrapper {border: 1px solid red}`.
The progress bar itself can also be customized to apply to all forms by targeting the `.gf_progressbar` class. For example, you can add a red border to the progress bar by adding the following CSS rule: `body .gform_wrapper .gf_progressbar_wrapper .gf_progressbar {border: 1px solid red}`.
If you want to apply the progress bar style to a specific form, you can target the form ID by adding the `#gform_wrapper_1` class. For instance, to add a red border to the progress bar of form ID #1, you can use the following CSS rule: `body #gform_wrapper_1 .gf_progressbar_wrapper .gf_progressbar {border: 1px solid red}`.
Here are some examples of progress bar styles that you can apply to all forms or specific forms:
Next Button
The Next Button is an essential element in multi-page forms, allowing users to move forward to the next step. It's a crucial part of the form navigation process.
To customize the appearance of the Next Button, you can use CSS selectors. For example, to apply a red border to the Next Button on all forms, use the following selector: body .gform_wrapper .gform_body .gform_page_footer .gform_next_button {border: 1px solid red}.
Alternatively, you can target a specific form ID, such as #1, by using the following selector: body #gform_wrapper_1 .gform_body .gform_page_footer .gform_next_button {border: 1px solid red}. This will apply the red border only to the Next Button on form ID #1.
If you're looking to apply the same styling to multiple forms, you can use the first selector. However, if you want to target a specific form, use the second selector.
Adjusting Items
You can adjust the appearance of list items in fields with multiple options using Ready Classes. This is especially helpful for forms with many items to select from, allowing you to group items into multiple columns and adjust their spacing.
To apply a style to all standard multiple-choice list items, use the following CSS code: `body .gform_wrapper .gform_body .gform_fields .gfield .gfield_radio .gchoice {border: 1px solid red}`.
If you want to apply a style just to a specific multiple-choice list item, you'll need to know the unique parent element ID. Once you have that, you can use the following code: `body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_radio .gchoice {border: 1px solid red}`.
Here are some examples of how to adjust list items with Ready Classes:
You can also use Ready Classes to adjust the appearance of individual form fields. For example, you can change the form label visibility, adjust the description and sub-label placement, modify the field size, or add a custom validation message.
Hiding the AM/PM Selector
If you want to hide the AM/PM selector in a Time field, you can add the gf_hide_ampm Ready Class to the field's settings.
This will only hide the field on the form, it will still be displayed in the form entry table in your backend dashboard.
You can also use this method to hide other unwanted form elements, but make sure to check the specific Ready Class you need to use.
For example, if you want to hide the "Characters Left" counter under Paragraph fields, you'll need to use the gf_hide_charleft Ready Class.
Here's a quick rundown of how to hide the AM/PM selector and the "Characters Left" counter:
Keep in mind that these Ready Classes are specific to Gravity Forms, so make sure you're using the right tool for the job.
Sources
- https://docs.gravityforms.com/css-targeting-examples/
- https://www.gravityforms.com/blog/css-ready-classes/
- https://gravitywiz.com/gravity-forms-css-styling/
- https://stackoverflow.com/questions/25716075/where-to-apply-custom-style-to-gravity-forms
- https://docs.gravitykit.com/article/589-styling-gravity-forms
Featured Images: pexels.com