更改表格中一个单元格的宽度

时间:2017-05-08 19:07:06

标签: html layout html-table html-email

我正在以表格形式发布电子邮件,我的目标是调整“了解更多”的大小,而不会调整行的其余部分。提供图像的效果:

MOCK-UP

我尝试添加一个width属性,但它没有用。

<table style="background-color: #a9cfee;">
    <tr style="border: none; font-family: arial, sans-serif; color:white; font-size: 43px; text-align: left; ">
        <td>
            <strong>ELITE GROOMING TUB</strong>
        </td>
        <td rowspan="3">
            <img src="tub.png">
        </td>
    </tr>
    <tr>
        <td style="border: none; font-family: arial, sans-serif; color:white; font-size: 15px; text-align: left;">
            We have made our premium tub even better. Stairs are extra sturdy but lighter weight. With the flick of a foot, they slide underneath the tub.
        </td> 
    </tr>
    <tr>
        <td style="border: none; font-family: arial, sans-serif; color:white; font-size: 15px; font-weight: 800; background-color: #0033a0; width: 50%;">
            Learn More
    </tr>
    </tbody>
</table>

1 个答案:

答案 0 :(得分:1)

现在我看到了图像,我正在完全修改我的答案。

您的表格结构无法以当前显示的方式显示。

例如,您有一个<td rowspan="3">的浴缸行。您需要在第一行中添加两个单元格的宽度,以使事情更好地流动。

该按钮还控制着桌子的宽度。我将它的大小放入单元格中的单独表格中,这样您就可以控制按钮的宽度而不会影响表格的宽度。

祝你好运。

<table style="background-color: #a9cfee;" border="1" width="580">
<tr style="border: none; font-family: arial, sans-serif; color:white; font-size: 43px; text-align: left; ">
    <td width="80%">
        <strong>ELITE GROOMING TUB</strong>
    </td>
    <td rowspan="3" width="20%">
        <img src="tub.png">
    </td>
</tr>
<tr>
    <td style="border: none; font-family: arial, sans-serif; color:white; font-size: 15px; text-align: left;">
        We have made our premium tub even better. Stairs are extra sturdy but lighter weight. With the flick of a foot, they slide underneath the tub.
    </td> 
</tr>
<tr>
    <td align="center" style="font-family: arial, sans-serif; color:white; font-size: 15px; font-weight: 800; text-align:center;">

      <table align="center" border="0">
        <tr>
          <td style="border: none; font-family: arial, sans-serif; color:white; font-size: 15px; font-weight: 800; background-color: #0033a0; width:200px; text-align:center;">Learn More</td>
        </tr>
      </table>
    </td>
</tr>
</tbody>

https://jsfiddle.net/wallyglenn/53ucukpo/