OptinMonster Documentation

Documentation, Reference Materials, and Tutorials for OptinMonster

Home

Docs

How to Use OptinMonster’s Custom CSS Tool

How to Use OptinMonster’s Custom CSS Tool

OptinMonster makes it easy to further customize your campaigns using CSS.

In this article, you’ll learn how to use OptinMonster’s custom CSS tool.

Before You Start

Here are some things to know before you begin:

  • We recommend using Chrome’s Dev Tools feature to inspect elements in your campaign to identify the specific selector to use when writing your CSS. Learn more about using Dev Tools here.

Custom CSS Tool

To use OptinMonster’s custom CSS tool, follow these steps:

  1. In the Design view of the campaign builder, select the Settings icon.
    Open the campaign settings from the footer toolbar in OptinMonster.
  2. Next, select the Advanced tab in the sidebar and expand the Custom CSS option.
    Add custom styling to your campaigns using the Custom CSS field in the campaign builder.
  3. Enter your custom CSS into the provided field.
  4. When you’re finished, Save your campaign.

Using Placeholders

Within the campaign builder you have access to a few placeholders you can use when writing your CSS selectors.

Campaign ID

When writing your CSS, we recommend you prefix each selector using the campaign ID. For example:

html div#om-{{id}} { /* your styles here */ }

When the CSS is generated by OptinMonster to show on your site, the {{id}} placeholder will automatically be updated to use the campaign’s unique ID.

In this example, we could change the background color of the buttons in the campaign using CSS like this:

Campaign Namespace

Another important feature of your OptinMonster campaign is the Campaign Namespace. This can be found in the Advanced tab’s Display Settings option.

You can customize the campaign namespace to use in CSS and Javascript targeting.

The HTML namespace prefix is used throughout your campaign template for classes and IDs and can be useful for getting around things like ad blockers.

You can use the Campaign Namespace in your custom CSS with the placeholder {{ns}}, for example:

Just like the {{id}} placeholder, the {{ns}} placeholder will automatically be updated to use your campaign’s namespace when the CSS is generated to show the campaign on your site.

Be advised that changing the Namespace setting will force a page refresh on save.

CSS Examples

The following examples are ways you can target CSS to specific elements in a campaign.

Target All Elements

This selector allows you to target all elements within all OptinMonster campaigns appearing on your site:

This selector is useful to apply a custom font family or applying “Right-to-Left” styles, etc.

Target Specific Sections

Pro Tip

This section will utilize some CSS called the “Attribute-Value Selector“, shown like [attribute$=value]. This selector targets the end of an ID’s name. If you’re unfamiliar with that selector, click the link above to learn more.

For instance, if you want to apply some CSS changes to the form area of your campaign you could use this selector:

FAQs

How can I learn more about using Chrome’s DevTools or Firefox’s Firebug?

You might find the following helpful to get started using your browser’s dev tools to customize CSS:

Can I use SASS or LESS in the CSS tool?

No, at this time only vanilla CSS can be used. SASS or LESS will not be rendered properly and may corrupt / break your campaign.

Troubleshooting

My CSS isn’t working, why?

If the custom CSS you’ve entered isn’t showing in the builder’s preview of your campaign right away, check the following:

  • That your CSS is correctly formatted with all proper semi-colons and curly braces. If any are missing, you may find some styles work as expected but all styles after the missing semi-colon or curly brace aren’t applied to your campaign.
  • Your CSS selector may not be specific enough to target the desired element. In this case, it may be helpful to try using the !important declaration to force the style to be applied.
  • Still not working? Our support team would be happy to help!

If you’re serious about jumpstarting your website business growth, then get started with OptinMonster today!

Get Started With OptinMonster Today!

BONUS: Done-For-You Campaign Setup ($297 value)

Our conversion experts will design 1 free campaign for you to get maximum results – absolutely FREE!

Click here to get started →


Still stuck?

How can we help?

Last updated on


Start Getting More
Leads & Sales Today
with OptinMonster!

Create and launch smart capture forms today in minutes. What are you waiting for?

Create and launch smart capture forms
today in minutes. What are you waiting for?

OptinMonster has transformed our business. Before integrating their optins, our clients saw a 2% conversion rate from web traffic, which is slightly above the standard for their industry. With the integration of OptinMonster’s lightbox popup, exit-intent technology, split testing, and other tools, our client’s conversion rates soared by an unprecedented 500%. They attracted substantially more customers while spending less on digital advertising. Their success propelled them to the top of their markets, outperforming national chains and other medical spas with much bigger marketing budgets. Our client’s success in their market has distinguished us in our own. We are now one of the most sought-after marketing firms in the industry of aesthetic medicine. We know that the integration of OptinMonster, more than any other tool or marketing strategy, has supported this growth and achievement.

chris zelig medstar media

Chris Zelig

Partner, Medstar Media

OptinMonster has been a game-changer for us. From driving donations to collecting new leads, there is nothing that this simple tool has failed to accomplish. Our lead collection rate has jumped by over 1,000%.

joe lowe american bird conservancy

Joe Lowe

Director of Digital Communications, American Bird Conservancy

Through OptinMonster’s exit-intent popups, we have more than doubled our sales conversion rate. Best of all is the compound effect of using OptinMonster over a long period of time—more conversions mean more customers, which means more word of mouth.

mitch smith, managing director, shockbyte

Mitch Smith

Managing Director, Shockbyte.com