How to make my email responsive?

Hi,

I am using custom html within email template.

I am struggling with making it responsive (define different layouts for different screen sizes). I am used to working with Media Queries when it comes to web, but I am starting to realize that email works differently (add to that the hubspot template framework).

1. Can you please guide me on the best approach? (should I use media quesries? is there any other recommended technique?)

2. If using media queries is the correct way to go, where should I write them? (in a “style” tag in the Head? is there any other place to add CSS?)

Background: My html is “injected” to a hubl variable using custom property, while the email is sent using single-send-API . I am using this technique because the html has logic that I wasn’t able to implement using hubl, so I am rendering it seperately using JS and sending the result as a parameter to the API.

Hope this makes sense…

Thanks in advanced!

@kerenc,

Emails do work differently than web pages. The reason being that while a web page is loaded in a browser (ie. chrome, firefox, IE, Safari), emails are loaded into email clients.

Browsers are always fighting to keep up with the latest in web development in order to have web pages look “right” in there product. There is a reason chrome and firefox are the most popular while IE and Safari have a much smaller user base, despite the latter being default browsers on most machines while the former are third party and need to be sought out and downloaded. The reason is that chrome and firefox give the best user experience when surfing the web, mostly due to them integrating new rules.

Email clients work the same way. They are essentially really dumb browsers though. Consider the emails you usually send and receive. They are usually plain text, maybe some formatting, and basic images. Most clients expect this. Now look at any marketing email template. It’s not exactly plain text. There is a lot of css, images, formatting, etc.

Basically email templates today are built the way that websites were in the 90’s, The almighty table. Export your template to a coded file and check out the code. I am 90% sure you will find tables inside of tables inside of tables. Going light on the css and structuring ensures that your email is properly processed by all email clients.

as for media queries, I wouldn’t do it. reason why? here.

So how do you make an email responsive?

1. percentages - try not to use exact widths, use percentages instead. You can place css in the head of your document. If you build custom structure in your email use tables and use percentage widths.

2. You will find a lot of email templates that are around 600px wide. This isn’t quite small enough for the smallest phones or large enough for the largest desktop screens, but it is a compromise between the two that (I guess, I don’t really do it) allows you to skip responsive adjustments on the template.

Keep in mind that you also have to worry about document size with some clients so it is best if you optimize your images to their smallest, keep the html and css light, and keep your messages short.

Thanks a lot for your detailed answer!

You are correct, the html is tables all over :slightly_smiling_face:

Can the percentages technique be used if I need to implement, for example, a 3 column layout in desktop (each column is 30% width) that should “collapse” to a single column in mobile (each column is 100% width)?

@kerenc,

That probably won’t work. The reason being that you would have to change the widths at a certain point which is where media queries come into play.

My expertise has more to do with blog customization. I don’t really go to crazy with email templates and I wouldn’t try what you are doing because I would be paranoid about compatability. That being said, This tutorial uses media queries and a google search for responsive email templates has no shortage of results. Just make sure you use Hubspot’s email client checker tool to ensure that you email won’t completely break.

Thanks! @Jsum