当使用 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/