enter image description hereIm building a email template in marketing cloud and i would like to use the external css inside the email template. I have created a css file and dragged and dropped in content builder folder but it didn't generate the link for the css file. I tried using the cloud pages code resource but when i used the url in the email template css was not rendering. Is there any solution for this?

3 Answers 3


Firstly, I would state that having externally referenced CSS inside of an email is a bad idea. I believe really only the Apple clients have full support, everything else is partial or no support (ref). Also see this link to Campaign Monitor to show support of 'Link' tag inside HTML emails.

Outside of that, To fulfill your need inside of Content Builder, you would need to load the CSS not into a content block, but as a piece of content. This is identical to how you upload images or documents. I would save the file inside of Notepad or similar editor and save it as a '.css' document. (e.g. myStyles.css). You then drag and drop that into Content Builder / Email Studio.

From there you can click on the item to bring up its properties and there you will find the reference link you need to insert into the email.

If you want to host it via CloudPages instead of Content Builder (recommended), you would just create a new 'Code Resource' page and then copy/paste in your CSS. You then use the URL for this 'page' inside your link tag. Please note that you are not using the 'Code Snippet' feature, but 'Code Resource'.

  • This is a little confusing. You say externally referenced CSS has support issues, but that externally referenced via CloudPages is recommended? Or are you saying externally linked via CloudPages is better vs externally linked via Content Builder (given that either uses [unrecommended] external referencing)?
    – BBaysinger
    Feb 18, 2022 at 11:46

I was confused by the other two answers, but I was able to accomplish including a chunk of CSS in a script element by inserting (drag/drop) an HTML block in the email template Content Editor. I was also able to accomplish similar by inserting CSS in HTML reference content. So there you have a way to do it as a one-off (click to edit) or as a reusable component.

<style type="text/css">
@media (prefers-color-scheme: dark) {
  .bggrey2 {
    background: #555;
    background-image: linear-gradient(#555, #555);
  [data-ogsc] .bggrey2 {
    background: #f2f2f2;
    background-image: linear-gradient(#555, #555);

For embedded [external], you may run into support issues on many email clients as Gortonington mentioned, but if you do decide to go this route then you should be able to "templatize" your CSS by putting it in a content block in Content Builder and then using the ContentBlockbyId() (https://developer.salesforce.com/docs/atlas.en-us.mc-programmatic-content.meta/mc-programmatic-content/contentblockbyid.htm) [or ContentBlockbyKey(), or ContentBlockbyName()] AMPscript function.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .