Add Custom CSS for your content
You can add your own custom CSS directly within the email or landing page design space. Use custom CSS to apply advanced and specific styling, for greater flexibility and control over the appearance of your content.
The custom CSS is appended to the <head>
section within a <style>
tag using the data-name="global-custom"
attribute. This structure ensures that the custom styles are applied globally to the content.
code language-html |
---|
|
Add your custom CSS
-
With at least one content component added in the canvas, select the Body component in the left navigation.
-
Select the Styles tab on the right and click Add custom CSS.
note note NOTE The Add custom CSS button is available only when the Body component is selected. However, you can apply custom CSS styles to all the components within it. The Add custom CSS pop-up editor is displayed with placeholder code comments.
-
Enter your CSS code in the editor.
Make sure that the custom CSS is valid and follows the proper syntax. If the entered CSS is invalid, an error message is displayed and the CSS cannot be saved. To learn more, see CSS validity.
-
Click Save to save the custom CSS.
The custom style sheet is applied to the existing content. You can check that your custom CSS is applied according to your needs. For information about how to make changes and adjust the style sheet application, see Troubleshooting.
CSS validity
code language-css |
---|
|
code language-css |
---|
|
Using <style>
tags is not accepted:
code language-html |
---|
|
Invalid syntax such as missing braces is not accepted:
code language-css |
---|
|
CSS in imported content
If you want to use custom CSS with content imported into the email or landing page design space, consider the following:
-
If you import external HTML content including CSS, it is populated in Compatibility mode and the CSS styles section is not available.
-
If you import content that was originally created in the email or landing page design space including CSS applied through the Add custom CSS option, the applied CSS is visible and editable from the same option.
Troubleshooting
If your custom CSS is not applied as expected, use the browser developer tools to inspect the content and verify that your CSS is targeting the correct selectors. As you review the styling code, consider the following:
-
Check that your CSS is valid and free of syntax errors (such as missing braces, incorrect property names).
-
Check that your CSS added to the
<style>
tag with thedata-name="global-custom"
attribute. -
Check if the
global-custom
style tag has the attributedata-disabled
set to true, such as:<style data-name="global-custom" type="text/css" data-disabled="true"> body: { color: red; } </style>
-
Check that your CSS is not overridden somewhere in the content, such as applied inline styling.
-
Add
!important
to your declarations to ensure that they take precedence, such as:code language-none .acr-Form { background: red !important; }