How to Build Horizontal Forms with Gravity Forms

Want to display your form’s fields horizontally, instead of vertically? Learn how in this quick step by step guide.

By default, Gravity Forms stacks form fields vertically. That works well for most forms, but shorter forms — like newsletter signups or simple lead forms — can also work nicely with the fields and Submit button on one row.

Gravity Forms can handle most of this directly in the form editor. In this guide, I’ll show you how to build a horizontal layout with drag-and-drop columns, place the Submit button at the end of the row, and make a few optional styling tweaks.

Using gf_simple_horizontal?

This Ready Class was deprecated in Gravity Forms 2.6. Use drag-and-drop columns and the Submit Button Location setting instead.

How to create Gravity Forms with a Horizontal Layout

Step 1 – Align Fields Using Drag and Drop Editor

 

Open the form you want to lay out horizontally. Drag each field into a Column Drop Zone to place the fields on the same row. You can also use the column handles to adjust their widths.

Then select the Submit button › open the Appearance tab › set Submit Button Location to End of the last row.

Gravity Forms Submit Button Appearance settings with “End of the last row” selected.

At this point your Gravity Form is now a horizontal form!

Gravity Forms horizontal form with Name, Email, and Submit button displayed on the same row.

Don’t see the column controls?

Your form may still be using Legacy Markup. Disable Enable legacy markup under Form Settings › Form Options first.

If it’s an older form, test the change before publishing to make sure any existing styling or custom code still works as expected.

Step 2 – Hide the Field Label and Sub Labels

Horizontal forms are often used where space is tight, so keeping your field labels short can help make the layout more compact.

You can also use placeholders as an extra hint for what to enter. I’d keep the field labels visible whenever possible, though. Gravity Forms recommends visible labels for accessibility, since placeholders disappear once someone starts typing.

 

Gravity Forms field Appearance settings with hidden labels and placeholders, alongside the resulting horizontal form.

Step 3 – Add Helper Styles

We’re getting close, but depending on your theme, you may notice that the fields and Submit button don’t line up quite the way you want.

These helper styles give you a starting point for tightening up the layout.

We’ll add them through Code Chest, a free Gravity Wiz plugin that lets you add CSS directly to a form. You can install it for free through Spellbook.

Open Settings › Code Chest, then paste the CSS into the CSS field. Leave Scope CSS to this form only enabled so these helper styles stay limited to this form.

</span>
<div>.ginput_container input,</div>
<div>.ginput_container select,</div>
<div>.gfield--type-submit button[type="submit"] {</div>
<div>height: 2.4rem;</div>
<div>}</div>
<div></div>
<div>.gfield--type-submit button[type="submit"] {</div>
<div>padding: 0 1.4rem;</div>
<div>}</div>
<div></div>
<div>.gform_fields {</div>
<div>grid-column-gap: 1vw !important;</div>
<div>}</div>
<div></div>
<div>.ginput_complex span:not(:first-child) {</div>
<div>padding-left: 1vw !important;</div>
<div>}</div>
<span style="font-size: 1.125rem;">

Want to see the form with your frontend styles applied?

Gravity Forms Dev Tools includes Preview Tools, which let you preview your form as it will appear on the frontend.

A Few Things to Keep in Mind

  1. Horizontal layouts work best for shorter forms with only a few fields.
  2. Gravity Forms supports up to four resizable columns.
  3. The Submit button can’t be placed inline on multi-page forms.
  4. Depending on your theme, you may still need a little CSS to fine-tune spacing or responsive behavior.

What questions do you still have?

Do you still have any questions about how to build horizontal forms with the Gravity Forms plugin in WordPress? We’d love to know what they are.

Comments

  1. Jeffrey Phillips
    Jeffrey Phillips March 15, 2022 at 6:49 pm

    I’m looking at the current Gravity Forms documentation on gf_simple_horizontal and see this: “This class is deprecated by the submit button being built directly into the Form Editor in Gravity Forms 2.6.” I was only able to get good results by setting a fixed width on the email field, otherwise it was short.

    Do you have any updated thoughts? Thanks!

    1. Dario Space
      Dario Space March 15, 2022 at 6:54 pm

      Hi Jeffrey,

      It seems the Submit button on GF 2.6 it’s available in the Form Editor and lets you set the width of the button in the Appearance tab. I would suggest reaching out to Gravity Forms support about this question.

      Cheers.

  2. Chris L-S
    Chris L-S April 20, 2021 at 1:09 pm

    Hi –

    Any thoughts on how to make validation errors (like required field needs to be entered) not mess up the formatting of horizontal forms?

    Thanks!

    1. Dario Space
      Dario Space April 20, 2021 at 1:52 pm

      Hi Chris,

      This is possible with custom CSS but will differ per theme and form. With Gravity Form 2.5 you will be able to setup the fields as blocks which will make it even easier.

  3. Ruud
    Ruud May 10, 2020 at 4:46 pm

    Applied one of the codes mentioned above and now at least the field and button are aligned and centered.

    (Green newsletter signup form at) https://www.alettahelena.com

    Now, I would like to have fields and button using the entire available space.

    Any suggestion would be honestly appreciated.

    Thanks in advance!

  4. Stuart
    Stuart March 12, 2020 at 3:20 pm

    Hi, I’m getting some strange behaviour with this one. I apply the css classes as described. It then “hides” my email field label and reduces the size of the email field box.

    any thoughts on why that would be and how to rectify?

    Thanks, Stuart

    1. Jason
      Jason March 18, 2020 at 10:41 pm

      It’s not working for me either, maybe GF have changed something on the CSS side that is causing issues with this?

    2. Ryan Donovan
      Ryan Donovan March 19, 2020 at 9:31 am

      Hey Jason, Excellent question. This seems to be a default interaction with gf_simple_horizontal. This only works with the “top label” form layout option. When added to “CSS Class Name” in your form settings will create a very simple horizontal form layout (think simple email address field and inline form button). The field label is hidden so using the placeholder option for the field is recommended. Please note that this works best on very simple, single-input field types. Also, it works best if you set the input size to “large” in the field settings. Let us know if you have any other questions.😀

  5. Robert Norcross
    Robert Norcross December 26, 2019 at 4:16 pm

    Is it possible to do this for mobile? Obviously wouldn’t make sense with a lot of fields, but we have 1 field and a “send” button.

    1. David Smith
      David Smith Staff January 7, 2020 at 3:35 pm

      I would expect this to work in mobile now. Do you have an example of what you’ve implemented with this so far?

    1. Scott Ryer
      Scott Ryer November 20, 2019 at 10:40 am

      Hi Annette, thanks for reaching out to us via Gravity Perks support. I wanted to follow up here for the benefit of other folks having this issue.

      The difference in styling between Chrome and Firefox was due to some existing CSS in the site’s theme. If you run into this, you can simply add this to your theme’s style sheet to force the form to 100% width in both browsers:

      http://snippi.com/s/13yiw81

  6. Andrew Peters
    Andrew Peters September 26, 2019 at 12:57 pm

    Is there a way to just make the submit button inline with the very last field?

    Like I want my whole form to be three lines. The first two lines would each have two questions, the last line would have one question then the Submit button.

  7. Chris
    Chris July 11, 2019 at 8:50 pm

    Thanks for this tutorial.

    I’m trying to add the form to a newsletter template that came with my theme. When I added the “gf_simple_horizontal” and “gf_inline” appropriately, the email field became smaller.

    Is there a way to increase the length of the email field (it’s in large already)?

    1. David Smith
      David Smith Staff July 12, 2019 at 8:10 am

      Hi Chris, the form-level classes override some of the styles on the form elements. You would need to use CSS to set a desired width on your Email field.

  8. Shmuel
    Shmuel April 4, 2019 at 5:37 pm

    How can I accomplish the same look for a multi-page form so that the next button would be in place of the submit button with same inline style?

    1. Cavtec
      Cavtec March 7, 2019 at 11:31 am

      Naturally the form appears to be aligned to the left. Is there a container or ready class to centralise this?

    2. David Smith
      David Smith Staff March 11, 2019 at 8:10 am

      I think I’m still misunderstanding? The “gf_simple_horizontal_wrapper” is the class to use to centralize this behavior.

    3. Brian
      Brian April 3, 2019 at 8:26 pm

      I’m having the same issue, I have have the gf_simple_horizontal set with gf_inline on all 3 input fields and the form is left justified left rather than center.

      https://termitetiger.com/test/

      I’m using Divi theme.

      Any clue why it is left rather than center justified?

    4. David Smith
      David Smith Staff April 3, 2019 at 9:19 pm

      Hi Brian, this is the default behavior of the gf_simple_horizontal ready class. You would need additional custom CSS to center it.

  9. Marianne
    Marianne March 28, 2018 at 5:04 pm

    how do you change the size of the fields for horizontal forms? I want only an email field with a button. The field size never changes. I tried selecting “small”, “medium” and “large”

    1. David Smith
      David Smith Staff April 11, 2018 at 11:37 am

      Looks like Gravity Forms doesn’t support this in this context. You would need to use CSS to set the sizes manually.

  10. ed
    ed January 30, 2018 at 4:48 am

    Do you have anything in your kit to add a modal box helper at the end of a field title for the person completing the form, much in the same way that the admin panel has them with the ‘?’ and when you hover additional explanation comes up. As some fields only display conditionally it needs to be in with the form title. I don’t want to swamp the form with extensive text in the description field that is offered. Thanks

  11. How To: Horizontal Forms &#8211; Pinnacle Pools &amp; Spa January 3, 2017 at 2:06 am

    […] Source: How to Build Horizontal Forms with Gravity Forms – Gravity Wiz […]

  12. Gravity Forms Felder horizontal anordnen › Tips und Tricks für WordPress, WordPress, WordPress Plugins December 5, 2016 at 4:01 am

    […] Jungs und Mädels von Gravitywiz empfehlen zusätzlich auch noch dem gesamten Formular die […]

  13. Rachel R.
    Rachel R. November 23, 2016 at 6:53 pm

    Do you know if there’s a way to make only part of form horizontal?

    Two or three fields can be placed on the same line with the “thirds” or “halves” style options — but not the submit button. So I have, for instance, some HTML fields I want above, and then a name, address, and submit button below that I’d like to be in a line. I can get the name and address on the same line, but I can’t seem to control the placement of the submit button.

    (Also, your readers should be aware that under normal circumstances, hiding the field labels and relying on placeholder text alone is bad practice. Screen readers, etc. used for accessibility purposes won’t read the placeholder; they need the label.)

    1. David Smith
      David Smith Staff November 23, 2016 at 8:52 pm

      Thanks, Rachel, I thought we had a mention in here about accessibility but it was actually on this other article.

      In regards to your question, I do not know of a ready solution for making only part of the form horizontal outside of the ready classes you already mentioned. You’d have to write some custom CSS to wrangle the submit button into it’s desired location.

    2. Rachel R.
      Rachel R. November 23, 2016 at 9:04 pm

      Well, drat. I was hoping there might be an easy way. This CSS newbie is struggling with all the CSS wrangling to get a decent-looking form. .lol

      Thank you!

  14. makii
    makii August 13, 2016 at 12:39 pm

    Hi, I tried gf_simple_horizontal with just an email field. But the field does not resize–it stays at small whether I select large or medium.

    Any suggestions? Thx!

    1. David Smith
      David Smith Staff August 14, 2016 at 7:45 am

      Hi Makil, the gf_simple_horizontal class overrides some of GF’s other styles, including the size setting. You can manually override the width for any input by adding a custom style to your theme’s stylesheet:

      input#input_1418_1 { width: 500px; }

      Where “1418” is your own form ID and the “1” is your field ID. Template: input#input_FORMID_FIELDID

  15. faithbegins
    faithbegins June 15, 2016 at 9:19 am

    I would like to Create 4 column table in Gravity form can you provide me the code

    Local Guardian (If Any): S.No Name Relationship Address (w/ tel. no.)

    Form & output should be like Table

Comments are closed.