[SalesForce] external css in email template

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?

Best Answer

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'.

Related Topic