Add custom CSS to your email content custom-css
Add your own custom CSS directly within the Marketo Engage Email Designer for advanced, specific styling.
Define custom CSS define-custom-css
-
Ensure there is some content defined in the Email Designer by adding at least one component.
-
Select Body, either from the Navigation tree on the left, or the right pane. CSS styles displays on the right.
note note NOTE The CSS styles section is only available when content is present in the editor. -
Click the + Add custom CSS button.
note note NOTE The Add custom CSS button is only available when Body is selected. However, you can apply custom CSS styles to all the components inside your content. -
Enter your CSS code in the dedicated text area that pops up. Make sure the custom CSS is valid and follows the proper syntax. Click Save when done.
note note NOTE You cannot add custom CSS to your content when using a template with locked content. The button label changes to View custom CSS and any custom CSS shown is read-only. -
Make sure the CSS applies to your content. If it doesn’t, check the Troubleshooting section.
note note NOTE If you remove all content, the section disappears, and the previously defined custom CSS is no longer applied. Add content back to make the CSS styles section reappear. The custom CSS is applied again.
Using valid CSS using-valid-css
You can input any valid CSS string in the Add custom CSS text area. Properly formatted CSS is immediately applied to the content.
Below are examples of valid CSS.
code language-css |
---|
|
code language-css |
---|
|
If invalid CSS is entered, an error message is displayed, indicating the CSS cannot be saved. Below are examples of invalid CSS.
Using <style>
tags is not accepted:
code language-html |
---|
|
Invalid syntax such as missing braces is not accepted:
code language-css |
---|
|
Technical implementation implementation
Your custom CSS is added to the end of the <head>
section as part of a <style>
tag with the data-name="global-custom"
attribute, such as in the example below. This ensures the custom styles are applied globally to the content.
code language-html |
---|
|
The custom CSS is not interpreted or validated by the Email Designer’s Settings pane. It is entirely independent and can only be modified through the Add Custom CSS option.
Guardrails - Imported content guardrails
If you want to use custom CSS with content imported into the Email Designer, consider the following:
-
If importing external HTML content including CSS, unless you convert that content, it will be in Compatibility mode, where the CSS styles section is not available.
-
If importing content created with the Email Designer includes CSS applied through the Add custom CSS option, the CSS previously applied will be visible and editable from the same option.
Troubleshooting troubleshooting
If your custom CSS is not applied, try the suggestions below.
-
Ensure your CSS is valid and free of syntax errors (such as missing braces, incorrect property names). Learn how
-
Ensure your CSS is being added to the
<style>
tag with thedata-name="global-custom"
attribute. -
Check if the
global-custom
style tag has the attributedata-disabled
set totrue
. If so, the custom CSS is not applied.accordion For example: code language-html <style data-name="global-custom" type="text/css" data-disabled="true"> body: { color: red; } </style>
-
Ensure your CSS is not overridden by other CSS rules.
-
Use your browser developer tools to inspect the content and verify your CSS is targeting the correct selectors.
-
Consider adding
!important
to your declarations to ensure they take precedence.accordion For example: code language-css .acr-Form { background: red !important; }
-