How To Style A Marketo Form Like A Pro

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