On this page: Learn how to add custom CSS to your email content in the Email Designer for advanced styling, how to keep your CSS valid, and how to troubleshoot styles that are not applied.
When designing your emails, you can add your own custom CSS directly within the Journey Optimizer Email Designer. This capability enables you to apply advanced and specific styling, for greater flexibility and control over the appearance of your content.
Define custom CSS define-custom-css
To add custom CSS to your email content, follow the steps below.
-
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 on top of the right pane. The CSS styles section displays on the right.
{width="85%"}
note NOTE The CSS styles section is only available when content is already present in the editor. -
Click the Add Custom CSS button.
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. Learn more
{width="65%"}
note NOTE When using a template with locked content, you cannot add custom CSS to your content. The button label changes to View custom CSS and any custom CSS already present in the content is read-only. -
Save your custom CSS and check that your custom CSS is correctly applied to your content. If this is not the case, check the Troubleshooting section.
{width="85%"}
-
If you remove all content, the section disappears, and the previously defined custom CSS is no longer applied.
-
Add content back to the editor to make the CSS styles section reappear. The custom CSS is applied again.
Ensure using valid CSS use-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 that 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 that 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-imported-content
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 converting that content, it will be in Compatibility mode, where the CSS styles section is not available. Learn more on importing existing content
-
If importing content created with the Email Designer including 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, consider the options below.
-
Ensure that your CSS is valid and free of syntax errors (such as missing braces, incorrect property names). Learn how
-
Ensure that your CSS is being added to the
<style>tag with thedata-name="global-custom"attribute. -
Check if the
global-customstyle tag has the attributedata-disabledset totrue. If this is the case, 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 that your CSS is not overridden by other CSS rules, including any theme applied to your content.
-
Use your browser developer tools to inspect the content and verify that your CSS is targeting the correct selectors.
-
Consider adding
!importantto your declarations to ensure they take precedence.accordion For example: code language-css .acr-Form { background: red !important; }
-
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
- TL;DR: The page explains how to add custom CSS to email content directly within the Journey Optimizer Email Designer for advanced and specific styling, how to make sure the CSS is valid, and what to check when the custom CSS is not applied.
Intents:
- Add custom CSS to email content in the Email Designer by selecting Body, either from the Navigation tree on the left or on top of the right pane, and using the Add Custom CSS button of the CSS styles section.
- Enter valid CSS in the Add custom CSS text area so that it can be saved and applied to the content.
- Find where the custom CSS is added in the HTML of the email content.
- Use custom CSS with content imported into the Email Designer.
- Troubleshoot custom CSS that is not applied to the content.
Glossary:
- CSS styles section (product-specific): The section that displays on the right of the Email Designer when Body is selected, and that contains the Add Custom CSS button.
- global-custom style tag (product-specific): The
<style>tag with thedata-name="global-custom"attribute, at the end of the<head>section of the email content, to which the custom CSS is added. This ensures that the custom styles are applied globally to the content.
Guardrails:
- The CSS styles section is only available when content is already present in the editor.
- The Add custom CSS button is only available when Body is selected. However, custom CSS styles can be applied to all the components inside the content.
- When using a template with locked content, you cannot add custom CSS to the content: the button label changes to View custom CSS and any custom CSS already present in the content is read-only.
- If you remove all content, the CSS styles section disappears and the previously defined custom CSS is no longer applied. When content is added back to the editor, the CSS styles section reappears and the custom CSS is applied again.
- If invalid CSS is entered, an error message is displayed, indicating that the CSS cannot be saved. Properly formatted CSS is immediately applied to the content.
- Users are responsible for the security of their custom CSS. Ensure that your CSS does not introduce vulnerabilities or conflicts with the existing content, and avoid using CSS that could unintentionally break the layout or functionality of the content.
- The custom CSS is not interpreted or validated by the Settings pane of the Email Designer. It is entirely independent and can only be modified through the Add Custom CSS option.
- If you import external HTML content including CSS, unless you convert that content, it is in Compatibility mode, where the CSS styles section is not available.
- If you import content created with the Email Designer including CSS applied through the Add custom CSS option, the CSS previously applied is visible and editable from the same option.
Terminology:
- Canonical name: Add custom CSS — variants: Add Custom CSS
FAQ:
- Why is the CSS styles section not available? The CSS styles section is only available when content is already present in the editor, so add at least one component first. For imported external HTML content that is not converted, the content is in Compatibility mode, where the CSS styles section is not available.
- Can custom CSS style components other than Body? Yes. The Add custom CSS button is only available when Body is selected, but you can apply custom CSS styles to all the components inside your content.
- What happens if I enter invalid CSS? An error message is displayed, indicating that the CSS cannot be saved.
- Can I add custom CSS when using a template with locked content? No. The button label changes to View custom CSS and any custom CSS already present in the content is read-only.
- Where is the custom CSS added in the email HTML? It is added to the end of the
<head>section as part of a<style>tag with thedata-name="global-custom"attribute. - What happens to the custom CSS if I remove all content? The CSS styles section disappears and the previously defined custom CSS is no longer applied. Adding content back makes the section reappear, and the custom CSS is applied again.
Troubleshooting:
-
Custom CSS is not applied: The page lists these checks:
- Ensure that your CSS is valid and free of syntax errors, such as missing braces or incorrect property names.
- Ensure that your CSS is being added to the
<style>tag with thedata-name="global-custom"attribute. - Check if the
global-customstyle tag has the attributedata-disabledset totrue. If this is the case, the custom CSS is not applied. - Ensure that your CSS is not overridden by other CSS rules, including any theme applied to your content. Use your browser developer tools to inspect the content and verify that your CSS is targeting the correct selectors, and consider adding
!importantto your declarations to ensure they take precedence.
Examples:
- Valid custom CSS for the Email Designer:
.acr-Form .spectrum-FieldLabel { width: 20%; }, or the media query@media only screen and (min-width: 600px) { .acr-paragraph-1 { width: 100% !important; } }. - Invalid custom CSS for the Email Designer: CSS wrapped in
<style>tags (for example<style type="text/css"> .acr-Form { width: 100%; } </style>) is not accepted, and invalid syntax such as missing braces (for examplebody { background: red;) is not accepted. - Use of
!importantin custom CSS:.acr-Form { background: red !important; }.
Related pages:
- For the editor in which custom CSS is added: Email Designer
- To add content to the Email Designer before defining custom CSS: component
- For templates in which custom CSS cannot be added: template with locked content
- For importing external HTML content into the Email Designer: Learn more on importing existing content
- For themes that can override custom CSS: theme
Personas:
- marketer: Can add custom CSS in the Email Designer by selecting Body and using the Add Custom CSS button. Can apply custom CSS styles to all the components inside the content. The page states that the CSS styles section is only available when content is already present in the editor. Where: “Define custom CSS”.
Onboarding:
- Level: Intermediate
- First minimal step: Ensure there is some content defined in the Email Designer by adding at least one component.
- Success check: Properly formatted CSS is immediately applied to the content.
- Previous: To have content defined in the Email Designer before adding custom CSS: component