百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

CssToInlineStyles

> 编程语言
开源

CssToInlineStyles 是一个类,可让您将 HTML 页面/文件转换为带有内联样式的 HTML 页面/文件。在发送电子邮件时,这非常有用。

5.8K stars0 点赞3 次浏览
访问官网GitHub

工具介绍

CssToInlineStyles 是一个类,可让您将 HTML 页面/文件转换为带有内联样式的 HTML 页面/文件。在发送电子邮件时,这非常有用。

CssToInlineStyles class

About

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

Installation

The recommended installation way is through Composer.

$ composer require tijsverkoyen/css-to-inline-styles

Example

use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;

// create instance
$cssToInlineStyles = new CssToInlineStyles();

$html = file_get_contents(__DIR__ . '/examples/sumo/index.htm');
$css = file_get_contents(__DIR__ . '/examples/sumo/style.css');

// output
echo $cssToInlineStyles->convert(
    $html,
    $css
);

Known issues

  • no support for pseudo selectors
  • no support for css-escapes
  • UTF-8 charset is not always detected correctly. Make sure you set the charset to UTF-8 using the following meta-tag in the head: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />. (Note: using <meta charset="UTF-8"> does NOT work!)

Sites using this class

  • Each site based on Fork CMS
  • Print en Bind
  • Tiki Wiki CMS Groupware (starting in Tiki 13)
  • Laravel Framework

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •no support for pseudo selectors
  • •no support for css-escapes
  • •Each site based on Fork CMS
  • •Print en Bind
  • •Tiki Wiki CMS Groupware (starting in Tiki 13)
  • •Laravel Framework

> 标签

PHP

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言