Gmail HTML email CSS not working - inline styles only solution?

I’m working on creating HTML emails and running into issues with Gmail specifically. When I send emails with CSS styles defined in the head section, Gmail completely strips them out or ignores them.

<!DOCTYPE html>
<html>
<head>
  <style type="text/css">
    .header-text {color: blue; font-size: 18px}
  </style>
</head>
<body>
  <h1 class="header-text">Welcome to our newsletter</h1>
</body>
</html>

The styling above doesn’t work in Gmail at all. However, when I use inline styles directly on the elements, it works fine:

<h1 style="color: blue; font-size: 18px">Welcome to our newsletter</h1>

This is really frustrating because inline styles make the HTML messy and hard to maintain. Does anyone know if there’s a workaround for this Gmail limitation, or am I stuck using only inline CSS for email styling? Any tips would be greatly appreciated!

Yeah, you’ve hit one of Gmail’s most annoying quirks. They strip CSS from the head section for security reasons, so inline styles are basically your only shot at consistent rendering. I’ve been doing HTML emails for six years and learned this the hard way. Tried tons of workarounds but Gmail’s updates kept breaking them. Email clients just handle HTML completely differently than browsers do. Here’s what works: develop with external CSS first, then run it through an automated inliner before you deploy. Premailer’s solid for this. Just remember Gmail blocks certain CSS properties even when they’re inline, so test everything in their interface before hitting send on your full list.

Yeah, Gmail’s a pain for this. Inline styles work but manually maintaining them sucks.

I write emails with regular CSS in the head (like your first example), then automate the conversion to inline styles before sending. Clean code during development, Gmail-compatible output.

I use Latenode for our company’s email campaigns. Set up a workflow that grabs your clean HTML with CSS classes, inlines everything, then pushes it through your email service. Runs automatically.

Latenode’s got HTML processing nodes and connects to basically any email service. Write your emails once with proper CSS, automation handles the inline mess every time.

Saves me tons of time vs manually inlining or fighting with tools that don’t mesh with our email stack.

Yeah, it’s the worst! I deal with this constantly. I just use a CSS inliner when creating emails - total lifesaver! MJML helps too since it handles compatibility issues. Saves me tons of time and keeps everything looking good.