이메일 콘텐츠에 사용자 정의 CSS 추가 email-metadata

이 페이지에서: 고급 스타일을 위해 전자 메일 Designer의 전자 메일 콘텐츠에 사용자 지정 CSS를 추가하는 방법, CSS를 유효하게 유지하는 방법, 적용되지 않는 스타일의 문제를 해결하는 방법에 대해 알아봅니다.

전자 메일을 디자인할 때 Journey Optimizer 전자 메일 Designer 내에서 직접 사용자 지정 CSS를 추가할 수 있습니다. 이 기능을 사용하면 고급 및 특정 스타일을 적용하여 콘텐츠 모양을 보다 유연하게 제어할 수 있습니다.

사용자 지정 CSS 정의 define-custom-css

이메일 콘텐츠에 사용자 지정 CSS를 추가하려면 아래 단계를 따르십시오.

  1. 하나 이상의 구성 요소를 추가하여 전자 메일 Designer에 일부 콘텐츠가 정의되어 있는지 확인하십시오.

  2. 왼쪽 탐색 트리 또는 오른쪽 창 상단에서 본문​을(를) 선택하십시오. CSS 스타일 섹션이 오른쪽에 표시됩니다.

    사용자 지정 CSS 추가 단추 선택 {width="85%"}

    note
    NOTE
    CSS 스타일 섹션은 편집기에 콘텐츠가 이미 있는 경우에만 사용할 수 있습니다.
  3. 사용자 지정 CSS 추가 단추를 클릭합니다.

    note
    NOTE
    사용자 지정 CSS 추가 단추는 본문​을 선택한 경우에만 사용할 수 있습니다. 하지만 사용자 지정 CSS 스타일을 콘텐츠 내의 모든 구성 요소에 적용할 수 있습니다.
  4. 표시되는 전용 텍스트 영역에 CSS 코드를 입력합니다. 사용자 지정 CSS가 올바르고 적절한 구문을 따르는지 확인하십시오. 자세히 알아보기

    전용 텍스트 영역에 사용자 지정 CSS 입력 {width="65%"}

    note
    NOTE
    잠긴 콘텐츠🔗가 있는 템플릿을 사용하는 경우 콘텐츠에 사용자 지정 CSS를 추가할 수 없습니다. 단추 레이블이 사용자 지정 CSS 보기(으)로 변경되고 콘텐츠에 이미 있는 사용자 지정 CSS는 읽기 전용입니다.
  5. 사용자 지정 CSS를 저장하고 사용자 지정 CSS가 콘텐츠에 올바르게 적용되었는지 확인합니다. 그렇지 않은 경우 문제 해결 섹션을 확인하십시오.

    전자 메일 콘텐츠에 적용된 사용자 지정 CSS {width="85%"}

  6. 모든 콘텐츠를 제거하면 섹션이 사라지고 이전에 정의한 사용자 지정 CSS가 더 이상 적용되지 않습니다.

  7. CSS 스타일 섹션이 다시 표시되도록 편집기에 콘텐츠를 다시 추가하십시오. 사용자 지정 CSS가 다시 적용됩니다.

유효한 CSS를 사용하는지 확인 use-valid-css

사용자 지정 CSS 추가 텍스트 영역에 올바른 CSS 문자열을 입력할 수 있습니다. 적절한 포맷의 CSS가 즉시 콘텐츠에 적용됩니다.

CAUTION
사용자는 사용자 지정 CSS의 보안을 책임집니다. CSS에 취약점이 도입되거나 기존 콘텐츠와 충돌하지 않는지 확인하십시오.
의도하지 않게 컨텐츠의 레이아웃 또는 기능을 손상시킬 수 있는 CSS를 사용하지 마십시오.
CSS 샘플

다음은 유효한 CSS의 예입니다.

code language-css
.acr-component[data-component-id="form"] {
  display: flex;
  justify-content: center;
  background: none;
}

.acr-Form {
  width: 100%;
  padding: 20px 100px;
  border-spacing: 0px 8px;
  box-sizing: border-box;
  margin: 0;
}

.acr-Form .spectrum-FieldLabel {
  width: 20%;
}

.acr-Form.spectrum-Form--labelsAbove .spectrum-FieldLabel,
.acr-Form [data-form-item="checkbox"] .spectrum-FieldLabel {
  width: auto;
}

.acr-Form .spectrum-Textfield {
  width: 100%;
}

#acr-form-error,
#acr-form-confirmation {
  width: 100%;
  padding: var(--spectrum-global-dimension-static-size-500);
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: var(--spectrum-global-dimension-static-size-200);
}

.spectrum-Form-item.is-required .spectrum-FieldLabel:after{
  content: '*';
  font-size: 1.25rem;
  margin-left: 5px;
  position: absolute;
}

/* Error field placeholder */
.spectrum-HelpText {
  display: none !important;
}

.spectrum-HelpText.is-invalid,
.is-invalid ~ .spectrum-HelpText {
  display: flex !important;
}
code language-css
@media only screen and (min-width: 600px) {
  .acr-paragraph-1 {
    width: 100% !important;
  }
}
잘못된 CSS 샘플

잘못된 CSS를 입력하면 CSS를 저장할 수 없음을 나타내는 오류 메시지가 표시됩니다. 다음은 잘못된 CSS의 예입니다.

<style> 태그를 사용할 수 없습니다.

code language-html
<style type="text/css">
  .acr-Form {
    width: 100%;
    padding: 20px 100px;
    border-spacing: 0px 8px;
    box-sizing: border-box;
    margin: 0;
  }
</style>

중괄호 누락과 같은 잘못된 구문은 허용되지 않습니다.

code language-css
body {
  background: red;

기술 구현 implementation

사용자 지정 CSS는 아래 예와 같이 data-name="global-custom" 특성이 있는 <style> 태그의 일부로 <head> 섹션의 끝에 추가됩니다. 이렇게 하면 사용자 지정 스타일이 콘텐츠에 전체적으로 적용됩니다.

샘플 참조
code language-html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="content-version" content="3.3.31">
    <meta name="x-apple-disable-message-reformatting">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <style data-name="default" type="text/css">
      td { padding: 0; }
      th { font-weight: normal; }
    </style>
    <style data-name="grid" type="text/css">
      .acr-grid-table { width: 100%; }
    </style>
    <style data-name="acr-theme" type="text/css" data-theme="default" data-variant="0">
      body { margin: 0; font-family: Arial; }
    </style>
    <style data-name="media-default-max-width-500px" type="text/css">
      @media screen and (max-width: 500px) {
        body { width: 100% !important; }
      }
    </style>
    <style data-name="global-custom" type="text/css">
      /* Add your custom CSS here */
    </style>
  </head>
  <body>
    <!-- Minimal content -->
  </body>
</html>

사용자 지정 CSS는 이메일 Designer의 설정 창에서 해석되거나 확인되지 않습니다. 완전히 독립적이며 사용자 지정 CSS 추가 옵션을 통해서만 수정할 수 있습니다.

보호 기능 - 가져온 콘텐츠 guardrails-imported-content

이메일 Designer으로 가져온 콘텐츠와 함께 사용자 지정 CSS를 사용하려면 다음을 고려하십시오.

  • CSS를 포함한 외부 HTML 콘텐츠를 가져오는 경우 해당 콘텐츠를 변환하지 않으면 CSS 스타일 섹션을 사용할 수 없는 호환성 모드​에 있게 됩니다. 기존 콘텐츠 가져오기에 대한 자세한 정보

  • 사용자 지정 CSS 추가 옵션을 통해 적용된 CSS를 포함하는 이메일 Designer으로 만든 콘텐츠를 가져오는 경우 이전에 적용된 CSS가 동일한 옵션에서 표시되고 편집할 수 있습니다.

문제 해결 troubleshooting

사용자 지정 CSS가 적용되지 않은 경우 아래 옵션을 고려하십시오.

  • CSS가 올바르고 구문 오류(예: 중괄호 누락, 잘못된 속성 이름)가 없는지 확인합니다. 방법 알아보기

  • CSS가 data-name="global-custom" 특성이 있는 <style> 태그에 추가되고 있는지 확인하십시오.

  • global-custom 스타일 태그에 data-disabled 특성이 true(으)로 설정되어 있는지 확인하십시오. 이 경우 사용자 지정 CSS는 적용되지 않습니다.

    accordion
    예:
    code language-html
    <style data-name="global-custom" type="text/css" data-disabled="true"> body: { color: red; } </style>
    
  • 콘텐츠에 적용된 테마를 포함한 다른 CSS 규칙으로 CSS가 재정의되지 않았는지 확인하십시오.

    • 브라우저 개발자 도구를 사용하여 콘텐츠를 검사하고 CSS가 올바른 선택기를 타깃팅하는지 확인하십시오.

    • 선언이 우선하도록 선언에 !important을(를) 추가해 보십시오.

      accordion
      예제:
      code language-css
      .acr-Form {
        background: red !important;
      }
      
AI Knowledge Reference

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 the data-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 the data-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 the data-name="global-custom" attribute.
    • Check if the global-custom style tag has the attribute data-disabled set to true. 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 !important to 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 example body { background: red;) is not accepted.
  • Use of !important in custom CSS: .acr-Form { background: red !important; }.

Related pages:

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
recommendation-more-help
journey-optimizer-help