How To Style A Marketo Form Like A Pro

In:

Marketo offers 7 themes that you can use for your forms, but what if you want your form to match your branding? You can add your own CSS style to match your brand, however, this is very difficult because Marketo adds their own CSS classes and inline CSS. Here is how you can style your Marketo form like a pro.

Adding Custom CSS

Before we dive into some tips and examples, it’s important to know how to update the custom CSS within Marketo. Navigate to the form and open up the form editor. Click on Form Settings > Form Theme > Edit Custom CSS this is where you can paste in your own CSS.

marketo-form-styling-edit-custom-css

Choosing a default theme

Marketo requires that you select one of their themes to start. Changing themes will affect the CSS as well as the structure of the HTML. For this tutorial, I will be using the “simple” theme which is the default theme when you create a new form.

marketo-form-theme-settings

Form Preview

Here’s what the form looks like with the default Marketo styling.

marketo-form-non-styled

The structure of a Marketo form

The typical HTML stucture for a text field in Marketo looks like this:

Almost all of the classes you see already have CSS properties attached to them, so in order to use your own styling within the form all those CSS properties need to be overridden with new ones.

Unbold the Label

By default, any fields that are marked as “required” will have labels that are bold. To override this you can add this piece of code.

marketo-form-not-bold

Responsive form fields

Field widths are set to a fixed width, to override the set field widths you can add a percentage width like this.

The mktoOffset

Above each form field there is a div with the class of mktoOffset. This DIV is used to control the vertical spacing of the form fields. The default CSS looks like this.

You can override the height and width by using this CSS

Center the Submit Button

The submit button is wrapped in a SPAN with an inline CSS style for margin-left. In order to center the submit button, the first thing you need to do is override the margin-left property and set it to 0px.

The submit button is also wrapped in a DIV with the class named mktoButtonRow. There is a CSS property to align the text to the left, so we need to override that and change it to CENTER. There is also no width on the DIV, so a width will need to be added.

Change the Button Style

To change the button style to match you brand, you will need to override the properties for .mktoForm .mktoButtonWrap.mktoSimple .mktoButton. Here are some examples of what that would look like

Full Width Button

Change the button background color

Remove the border from the button

Add padding to the button

Change the font size of the button

Fixing the radio buttons and checkboxes

If you have chosen to have the Marketo labels “above the form” instead of “to the left”, you might encounter an issue with the label for the radio buttons and checkboxes showing below the label.

marketo-form-checkbox-radio-fix

Add this CSS code to put the label and the checkbox/radio button beside each other.

marketo-form-checkbox-radio-fix-2

Questions?

Email me, send me a tweet @jennamolby, or leave a comment

Related Posts

  • 17/06/2019
    How to Integrate Gravity Forms With Pardot

    Gravity Forms is one of the easiest tools to create advanced forms for your Wordpress website and with some customization they can be integrated with Pardot. In this post, I will show you how to integrate Gravity Forms using Pardot Form Handlers.

  • 11/06/2019
    How to Turn Any Email Template into a Pardot Email Template

    Do you know you can turn any email template into a Pardot email template? With a couple of modifications to the HTML, you can have a fully functional Pardot email template which allows you to remove, edit and duplicate sections. In this tutorial, I will show you how to take any free, responsive email template and turn it into a Pardot email template.

  • 22/04/2019
    8 Noteworthy Features in the Salesforce Summer ’19 Release

    The Salesforce Summer ‘19 release is quickly approaching and soon you’ll be able to take advantage of exciting new features and functionality. Here is a recap of 8 of my favorite features in the Salesforce Summer ’19 release, including enhanced related lists, new record view options, quick filters and more.

14 comment(s)
  • Brie Edmonds

    25/09/2017 at 1:43 pm
    Reply

    This has been by far been one of the best tools I have been able to use to fake my way through Marketo. I am making it because of you and your easy to understand instructions on how to make things great. Thank you soo much!

  • Zofia Szyszka

    31/08/2017 at 7:13 pm
    Reply

    Hey Jenna, great article! Thank you, it helped me a lot! The only thing I can't seem to be able to target now are the rounded corners on a select box! So frustrating... Would you know how to make them square? Thanks! Zofia

    • Jenna Molby
      to Zofia Szyszka

      01/09/2017 at 9:34 am
      Reply

      Hi Zofia, Add this CSS to make the corners for a select box square. select {-webkit-appearance: none; -webkit-border-radius: 0px;}

  • Jacob Brissee

    10/08/2017 at 7:54 pm
    Reply

    This is interesting but I have an even more basic question: How do I get forms to center? I'm using a guided landing page template and the widget is wider than the form. I assume I can 100% it and margin:auto but I don't know what class to reference.

    • Jenna Molby
      to Jacob Brissee

      11/08/2017 at 9:12 am
      Reply

      Hi Jacob, You can reference the 'mktoForm' class like this form.mktoForm {margin-left:auto;margin-right:auto;}

  • Natasha M.

    06/03/2017 at 11:26 am
    Reply

    Hi , This post is very useful .I just had a question about the checkbox CSS .How can i have the checkbox to the left and label of the checkbox to the the right .

  • Mike Sherwood

    29/12/2016 at 11:44 am
    Reply

    This is really great. Thanks. Two questions: 1. It seems half the battle is finding out which classes to change. There is no documentation as far as I can see. How do you go about discovering the class names to select? 2. This is a pure css question. What is the difference between having a space between the class names and not? For example, the difference between this: .mktoButtonWrap.mktoSimple (no space between) and .mktoButtonWrap .mktoSimple (with space between) How are those different? thx, Mike

    • Jenna Molby
      to Mike Sherwood

      29/12/2016 at 12:18 pm
      Reply

      Hi Mike, so happy you found the post useful! I use Chrome DevTools to figure out which classes need be changed. You can find info on how to use Chrome DevTools here: https://developer.chrome.com/devtools. Without a space in a CSS selector, it's just like it's one class, when you have a space the CSS is applied in a hierarchy such that it looks for mktoSimple within the children of elements with mktoButtonWrap.

Leave A Comment

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

About Me

Welcome to my blog, where I share, tips, tricks, thoughts and solutions that I learn in my daily life as a sales and marketing professional.

LEARN MORE

Categories
Most Commented
Popular Posts