7

In Template Content i have put

<p class="test">Hi</p>

Template Styles i have put

.test { font-size: 40px;}

Then i have clicked on Preview Template, but it's not applying.

I like to apply CSS for this template only.

enter image description here

3
  • How you add your style? Jan 5, 2017 at 10:14
  • Didn't get you as mentioned in question
    – Jackson
    Jan 5, 2017 at 10:20
  • I added screenshot for same @KhoaTruongDinh
    – Jackson
    Jan 5, 2017 at 10:23

2 Answers 2

12

First of all, we need to read here: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/templates/template-email.html#non-inline-styles.

For the Non Inline Styles, they must be in a <style type="text/css"></style> tag for them to work. In your case, we only need to include the header {{template config_path="design/email/header_template"}} in your custom email. Or, we can add the code lines below directly in the custom email:

<style type="text/css">
    {{var template_styles|raw}}
</style>

enter image description here

2
  • You are a saviour my friend :) +1 Oct 1, 2019 at 17:27
  • How to add this non-inline style in .phtml? Jan 2, 2020 at 6:45
0

When switching the HTML editor on/off the tags get removed. Is there another solution to have Template Styles be included?

1
  • Please add more content for more details
    – Msquare
    Mar 22, 2020 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.