I have an email template, and I want the user to be able to add custom style tags to a global variable, so that it gets place inside the head tags. This seems to work if you have a short string, like customizing the phrase in the title tags, but if you attempt to do this for style tags, containing CSS, the resulting code will move the style tags into the body tags. Does anybody know if this is possible to do?
Solved! Go to Solution.
I haven't run into this issue specifically so long as you're using a variable within the <style> tags and the variable <meta> tag comes before the <style> tag in the head, something like this:
<head>
<meta class="mktoString" id="Custom-CSS" mktoName="Custom CSS" default="body {color: red;}">
<style>${Custom-CSS}</style>
</head>
It'd be helpful to see the string of CSS you're looking to include and how you have the HTML portion of the email setup as well as what you're seeing as an output compared to what you've got setup on the template.
Another idea here might be to use a token rather than a variable?
<head>
<style>{{my.EM Custom CSS}}</style>
</head>
Please share the template code you’re actually using (not the whole thing, but the relevant <head>
tags that are sufficient to reproduce the behavior).
I haven't run into this issue specifically so long as you're using a variable within the <style> tags and the variable <meta> tag comes before the <style> tag in the head, something like this:
<head>
<meta class="mktoString" id="Custom-CSS" mktoName="Custom CSS" default="body {color: red;}">
<style>${Custom-CSS}</style>
</head>
It'd be helpful to see the string of CSS you're looking to include and how you have the HTML portion of the email setup as well as what you're seeing as an output compared to what you've got setup on the template.
Another idea here might be to use a token rather than a variable?
<head>
<style>{{my.EM Custom CSS}}</style>
</head>
Hi. Thank you for your reply. I initially had basically the same approach to your sample, and I was using a web version link to see the resulting source code. For some reason, the style tag was being forced out into the body tags on the web version. I started over, same approach, and now it seems to be working, without the style tags being forced into the body tags. Maybe I was ordering something incorrectly the first time around. Regardless, thank you again!