【问题标题】:Change width of ONE cell within table更改表格中一个单元格的宽度
【发布时间】:2017-10-06 21:59:42
【问题描述】:

我正在以表格格式布置一封电子邮件,我的目标是调整“了解更多”的大小,而不调整其余行的大小。与所提供图片的效果有关:

.

我尝试添加宽度属性,但没有成功。

<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>

【问题讨论】:

    标签: html layout html-table html-email


    【解决方案1】:

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

    您的表格结构不会像您当前显示的那样很好地显示。

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

    该按钮还控制表格的宽度。我把它的尺寸放在单元格内的一个单独的表格中,这样你就可以控制按钮的宽度而不影响表格的宽度。

    祝你好运。

    <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/

    【讨论】:

    • 是的,这是要走的路。将您的外部&lt;table&gt; 保持在全宽,然后一秒钟,更窄的&lt;table&gt; 仅用于按钮。
    猜你喜欢
    • 1970-01-01
    • 2011-06-10
    • 1970-01-01
    • 2015-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多