Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

CSS for Email | CSS Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. CSS Course

Lesson 37 of 50

·css

CSS for Email

10 mins

Course progress74%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • Inline every rule; external CSS files are ignored by many clients.
  • Use `width` attributes on `<table>`/`<td>` to control layout.
  • Test with **Litmus**, **Email on Acid**, or the free **Mailtrap** sandbox.

Email clients support a limited subset of CSS. Follow these rules:

  • Use inline styles for maximum compatibility.
  • Avoid position, float, flex, grid (most clients strip them).
  • Use tables for layout, but you can still apply simple text styles.
  • Include a plain‑text fallback (multipart/alternative).

Example: Simple promotional email

<table width="100%" cellpadding="0" cellspacing="0" border="0" style="font-family:Arial,sans-serif;">
  <tr><td style="background:#0066cc; padding:20px; text-align:center; color:#fff;">
    <h1 style="margin:0; font-size:24px;">Special Offer</h1>
  </td></tr>
  <tr><td style="padding:20px;">
    <p>Get 30% off your first purchase.</p>
    <a href="#" style="display:inline-block; background:#ff6600; color:#fff; padding:10px 20px; text-decoration:none;">Shop Now</a>
  </td></tr>
</table>
Make it stickPractice what you've learned1 quiz · 6 practical tests · Optional activities from CSS CourseBrowse activities
Previous lessonPrint StylesheetsContinue to lesson 38CSS Performance – Critical CSS & Unused CSSBack to CSS Course curriculum