I'm generating a html email that uses an internal stylesheet, i.e.
<!doctype html> <html> <head> <style type="text/css"> h2.foo {color: red} </style> </head> <body> <h2 class="foo">Email content here</foo> </body> </html>
When viewed in Gmail it seems all the styles in the internal stylesheet are ignored. It seems Gmail ignores all styles other than inline rules, e.g.
<h2 style="color: red">Email content here</foo>
Is this my only option for styling HTML emails when viewed with Gmail?
To embed HTML in an email in Gmail, copy the code in a plain text format and render the code in a web browser first. Opening the HTML file in Chrome or another browser is just fine. This will display the email as it will appear in Gmail. Copy everything from the web browser display and paste directly into Gmail.
Use inline styles for everything. This site will convert your classes to inline styles: http://premailer.dialect.ca/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With