How to Create Responsive Marketo Forms

In:

Marketo forms, by default, have set widths for many elements including all the form fields, labels and even the form itself. If you’re embedding your form in a responsive landing page, you might want to make the form fully responsive as well. With a bit of CSS, you can make your one-column and two-column Marketo forms look great on every device.

Single Column Forms

Single column forms are easy to make responsive. All you have to do is override some pixel widths with percentage widths. Here’s a breakdown of what elements have to be updated. If you just want to copy and paste the final code click here to jump to the final CSS.

Change the form width to a percentage

Marketo will give the form a fixed pixel width by default, so the first step is to switch the width of the form to a percentage. I usually change the form width to 100% and define the container width for the form in the landing page template.

Tip: Make sure you don’t leave out the !important declaration. Since Marketo adds width as an inline style to the form tag, this is the only way to override the inline styling.

Update .mktoFormRow, . mktoFormCol, .mktoButtonRow and .mktoFieldWrap to 100%

The next step is to update .mktoFormRow, .mktoButtonRow, . mktoFormCol and .mktoFieldWrap to 100%, like this:


Update the form fields to a percentage

All of the form fields have a fixed pixel width as well. Just like the form element, you have to add the !important declaration for this as well to override the inlines styles Marketo outputs.


Center the submit button

If you want to center the submit button on the form you can add this CSS:


The final CSS


A note about field label widths

Field labels have fixed pixel widths as well. However, I usually leave it that way since it doesn’t usually impact the responsiveness of the form unless the labels are more than 300px wide. Label widths can be updated like this:



Two-Column Forms

Two-column forms are a bit more complicated than single column forms. I’ve tried many ways to achieve a two-column Marketo form, including adding javascript to add classes to different form elements, but I prefer the CSS method better.

Drag your form fields into two-columns in the form editor

The first step is to use the form editor to create the two-columns.

Change the form width to a percentage


Update .mktoFormRow, .mktoButtonRow and .mktoFieldWrap to 100%


Update the form fields to a percentage


Update the columns to a percentage width


Add some padding between the two columns


Center the submit button

If you want to center the submit button on the form you can add this CSS:


Add a media query to stack the columns on mobile

This example uses the same breakpoint as the default Marketo CSS. Feel free to change it based on your requirements.

The Final CSS

The final CSS for the two-column form.


Questions?

Send them to me via email, send me a tweet @jennamolby, or leave a comment

Related Posts

  • 05/07/2017
    Make Your Marketo Forms More User-Friendly With This Tip

    I was registering for a webinar this week and when I went to select my Country from the drop-down, I was greeted with a search feature for the drop-down. I immediately started Googling what JavaScript plugin they were using to see if I could use it on Marketo forms. It turns out, you can and not only is it super easy to implement, but it also makes long drop-down in your Marketo forms more user-friendly. I’ll walk you through how I did this in 4 easy steps.

  • 04/01/2017
    Beautiful Marketo Forms: Styling Checkboxes and Radio Buttons

    Your Marketo forms don’t have to be boring. With a little extra CSS you can create beautiful Marketo forms with customized checkboxes and radio buttons. In this tutorial, I’ll show you how you can style checkboxes and radio buttons within Marketo forms with minimal coding.

  • 27/10/2016
    How to Create a 2 Column Pardot Form

    After launching my Form Style Generator for Pardot Forms, the number one question I receive is ‘how do I create a 2 column form in Pardot?’ I might update the style generator to include this in the future, but in the meantime, here’s how to create a 2 column Pardot form with minimal coding.

3 comment(s)
  • Stephan

    29/09/2017 at 8:26 am
    Reply

    Can you please enhance the code for a three column form? What CSS needs to be added?

    • Jenna Molby
      to Stephan

      29/09/2017 at 2:23 pm
      Reply

      Hi Stephan, You would need to drag your fields into three columns within the Marketo form editor and then update the line of CSS for .mktoFormCol to around 33% instead of 50%. Hope that helps!

  • Tim Ball

    25/09/2017 at 9:35 pm
    Reply

    Thanks Jenna, This is exactly what i have been looking for, great article.

Leave A Comment

Your email address will not be published. Required fields are marked *

About Me

I am a results focused marketing automation expert, with a strong background in design and development. With a high level computer science background, I have the unique ability to design, code and understand data, while utilizing this skillset to further enhance my value and ROI in the digital marketing space.
LEARN MORE

Categories
Most Commented
Popular Posts