html - 电子邮件中未显示 CSS 样式

标签 html css email html-email mutt

当使用 mutt 通过电子邮件发送以下 html 页面(Yahoo/Gmail)时,我看不到 CSS 样式。我只看到一个普通表格。但是在浏览器中查看时我得到了所需的样式。为什么 ?我错过了什么吗?

mutt -e "set content_type=text/html" me@mail.com -s "Test" < Test.html

测试.html

<!DOCTYPE html>
<html>
<head>
<style>
rd{ color: red; }
gn{ color: green; }
body { background-color:#E0E0E0; font-family: helvetica;font-size: 15px;}
</style>
</head>
<body>
<table border="1" align ="left">
<tr><th>No.</th><th>Item</th></tr>
<tr><td>1</td><td><gn>abc</gn></td></tr>
<tr><td>2</td><td><rd>ghi</rd></td></tr>
</table>
</body>
</html>

最佳答案

在 HTML 电子邮件中包含 CSS 的方法是使用内联样式。

    <!DOCTYPE html>
    <html>
    <body style='background-color:#E0E0E0; font-family: helvetica;font-size: 15px;'>
        <table border="1" align="left" style="color:red;">
            <tr><th>No.</th><th>Item</th></tr>
            <tr><td>1</td><td><gn>abc</gn></td></tr>
        </table>
    </body>
    </html>

引用:http://www.htmlgoodies.com/beyond/css/article.php/3679231

关于html - 电子邮件中未显示 CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20007948/

相关文章:

css - 在 CSS #unseen 样式方面需要帮助

email - 如何检索订阅列表 milajet api v3 的所有联系人

html - 搜索栏高度不会改变

html - 如何将悬停叠加文本固定到图像

javascript - 如何防止在 Chrome 中调整图像大小时模糊?

php - Gmail 将我的电子邮件视为网络钓鱼?

c# - 发送格式化电子邮件 Asp.Net

javascript - 在打开的网站上加载图像

javascript - Angular Material 表拖放列排序不起作用

css - YouTube按钮高度