html - 电子邮件中的表格单元格高度问题

标签 html css email

我在 html 电子邮件中有以下代码:

<table style="margin: 32px 0; border: 0; border-spacing: 0; border-collapse: collapse;">
    <tr>
        <td style="width: 50%; vertical-align: top; padding: 0; border: 0; line-height: 1; background: red;">Invoice Number</td>
        <td style="width: 50%; vertical-align: top; padding: 0; border: 0; line-height: 1; background: red;"></td>
    </tr>
    <tr>
        <td style="width: 50%; vertical-align: top; padding: 0; border: 0; line-height: 1; background: red;">Tax Point</td>
        <td style="width: 50%; vertical-align: top; padding: 0; border: 0; line-height: 1; background: red;">30/11/2017 11:48:32</td>
    </tr>
    <tr>
        <td style="width: 50%; vertical-align: top; padding: 0; border: 0; line-height: 1; background: red;">Payer ID</td>
        <td style="width: 50%; vertical-align: top; padding: 0; border: 0; line-height: 1; background: red;">Senior Internet</td>
    </tr>
</table>

<table class="invoice-items">
    <tr>
        <th style="font-family: sans-serif; padding: 10px;">Description</th>
        <th style="font-family: sans-serif; padding: 10px;">Item Amount</th>
        <th style="font-family: sans-serif; padding: 10px;">Quantity</th>
        <th style="font-family: sans-serif; padding: 10px;">VAT Amount</th>
        <th style="font-family: sans-serif; padding: 10px;">Line Total</th>
    </tr>
    <tr>
        <td style="padding: 10px;">Charity/ public sector</td>
        <td style="padding: 10px;">360.0000</td>
        <td style="padding: 10px;">1</td>
        <td style="padding: 10px;">72.0000</td>
        <td style="padding: 10px;">360.0000</td>
    </tr>
    <tr>
        <td colspan="3" class="empty">&nbsp;</td>
        <td class="no-border">Total</td>
        <td class="green no-border">£432.0000</td>
    </tr>
</table>

但是,我遇到了第一个表格的单元格高度太大的问题。我试过设置填充、边框、行高,但我无法让红色单元格成为其中文本的高度。 enter image description here

最佳答案

这与您正在使用的 CSS 或电子邮件客户端有关,您的代码在这里正常工作,请检查它是如何在纯 HTML 文件中呈现的:

How it is rendered in plain HTML

查看此答案以测试 HTML 模板: https://stackoverflow.com/a/1019166/4129382

关于html - 电子邮件中的表格单元格高度问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47572877/

相关文章:

php - 没有收到来自 PHP mail() 方法的电子邮件

java - 如何使用Java确认电子邮件?

html - 多列 - 首先填充左列

javascript - 从 AWS S3 加载图像时获取响应 header

javascript - anchor 链接不适用于 jquery event.preventDefault;

css - 使用 CSS 变量时 VS MVC 元素 CSS 缩小失败

html - CSS - 如何创建这样的圆形饼图 Canvas ?

javascript - jquery 目标空白不起作用

html - 实现可以是全高或仅标题的渐变技术

php - 如何将电子邮件值传递给 url