tijsverkoyen/CssToInlineStyles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending...

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 56 minutes ago
Added to GitGenius on September 11th, 2026
Created on October 25th, 2010
Open Issues & Pull Requests: 32 (+0)
GitHub issues: Enabled
Number of forks: 190
Total Stargazers: 5,825 (+0)
Total Subscribers: 52 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

CssToInlineStyles is a PHP class that converts HTML documents to versions with inline styles, useful for email delivery where external stylesheets are unreliable.

The tool solves the problem that many email clients strip or ignore external CSS files and style tags, breaking the visual presentation of HTML emails. It works by parsing the HTML document, extracting CSS rules from style tags and linked stylesheets, and applying those styles directly as inline style attributes on the relevant elements. This ensures email clients render the intended appearance regardless of their CSS support limitations.

Developers sending HTML emails should adopt this tool if their application generates email content and needs consistent styling across email clients. It works well for transactional emails, newsletters, and any scenario where HTML is composed server-side and delivered via SMTP. The tool has known limitations: it does not support pseudo-selectors like hover or focus, does not handle CSS escape sequences, and requires explicit UTF-8 charset declaration using the older meta http-equiv tag rather than the HTML5 charset attribute. These constraints mean it suits straightforward email templates with static styling but not complex stylesheets relying on advanced CSS features.

The project maintains a stable, focused codebase without active feature expansion. Development activity is minimal, with no recent commits or ongoing issue resolution visible. The tool has achieved adoption in established projects including a major PHP framework and several CMS platforms, suggesting it has reached a mature state where it functions reliably for its intended purpose without requiring frequent updates.