elements
Blog Demos UI Docs Pricing
Elements Manual
  • Getting Started
  • CLI
  • Build
  • Browser
  • Packages
  • TypeScript
  • Elements HTML
  • Assets
  • RPC
  • Router
  • Session
  • Database
  • Migrations
  • LiveTable
  • Channel
  • Jobs
  • Email
  • Payments
  • JSON
  • Async
  • Style
    • Install
    • Tokens
    • Base elements
    • Typography
    • Layout
    • Components
    • Utilities
    • Theming
    • Overriding
    • Email
    • Reference
  • UI
  • JSOC
  • Config
  • Tests
  • Logs
  • Deploy
  • Editors
  • Recipes
  • Licenses
Manual / Style/ Email

Email

elements man style/email

A mail-safe baseline for HTML emails. This is email.css, imported separately from the main stylesheet:

Import
@import "@elements/ui/email";

In a scaffolded app it's already wired into app/shared/styles/email.css, which every email's style.css imports.

Why it's different

Mail clients (Gmail, Apple Mail, Outlook, web clients) are far stricter than browsers. They can't reliably resolve CSS custom properties, they support @media unevenly, and they often demand inline styles. So email.css breaks from the rest of the package on purpose:

  • No CSS variables. Every value is a raw px or hex so the CSS renders the same everywhere without a token resolver in the loop.
  • No layers, no @media, no @container. Just plain rules.
  • Light-only. There's no dark-mode flip. Mail clients handle dark mode themselves, and variable-based theming wouldn't survive anyway.

Keep any additions to this file in the same shape: raw values, no vars, no media queries, no layers.

Scope

Every rule is scoped under .email, so the baseline never leaks onto your website. The email generator tags each email template with <body class="email <slug>">, so the baseline applies inside emails only.

Classes

Class Role
.email The body baseline: system font, 16px/1.55 text, dark ink on white, comfortable page padding
.email-wrap A centered single-column wrapper capped at 560px, so the email reads well on desktop and scales down on mobile without media queries
.email-footer The small-print footer treatment: a top rule, smaller muted text for the sender address, unsubscribe link, and legal

Bare .email a, .email h1/h2/h3, and .email p are styled too, so basic email content looks right with no extra classes.

Welcome email
<body class="email welcome"> <div class="email-wrap"> <h1>Welcome aboard</h1> <p>Thanks for signing up. Here's how to get started…</p> <div class="email-footer"> <p>Sent by Your Company · <a href="#">Unsubscribe</a></p> </div> </div> </body>

Styling an Email

An email's own rules go in its style.css, scoped under .email.<name>. What holds up across mail clients:

  • Raw values. px and hex. No var(), oklch(), @media or @layer.
  • One column. Everything inside .email-wrap. Content side by side goes in a <table>: flex and grid render differently from one client to the next.
  • Under 16 KB of CSS. Gmail drops the whole <style> above that, so an email never imports a page stylesheet or a UI component's CSS.
  • Readable with no CSS. The Gmail apps remove <style> for accounts that are not Gmail. Headings, paragraphs and a plain link carry the message there.
  • Images with a size. A width attribute and alt text on every <img>, so a client that blocks images keeps the layout.

A button is a link with padding and a background:

app/emails/welcome/style.css
@import "#app/shared/styles/email.css"; .email.welcome .button { display: inline-block; padding: 12px 20px; border-radius: 6px; background: #2563eb; color: #ffffff; font-weight: 600; text-decoration: none; }

To look at an email while you style it, give it a preview route (see elements man email).

Prev OverridingNext Reference
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026