我对html
概念很新,我试过阅读其他文章/帖子,但我仍然不明白。
我必须在rails应用程序中格式化模板邮件。模板是我老板给的。
我目前正在将html.erb转换为html.haml,因此语法将是haml。
因为我不是前面的开发者,所以有些令我不安。
模板有很多这样的行
<td class="headerContent" style="border-collapse: collapse;color: #202020;font-family: Arial;font-size: 34px;font-weight: bold;line-height: 100%;padding: 0;text-align: center;vertical-align: middle;">
和上面的css这样的
.headerContent {
color: #202020;
font-family: Arial;
font-size: 34px;
font-weight: bold;
line-height: 100%;
padding: 0;
text-align: center;
vertical-align: middle;
}
为什么在<td ...>
定义中有样式定义,因为.headerContent
类已经在css块中声明了?
我也在许多地方声明了关键字!important
,我读过关于样式覆盖的文章,对我来说仍然模糊不清。
为什么所有样式定义都不只是在一个css块/文件中?混合html和css有点令人不安
答案 0 :(得分:1)
您的电子邮件模板看起来像是premailer之类的内容。这是一件好事&#34;™,因为<style>
元素中的某些电子邮件客户don't support <head>
代码。它是丑陋和粗暴的,但如果你想支持gmail用户,最终是一个必要的恶魔。