【问题标题】:HTML email table stretching horizontally when lots of text大量文本时水平拉伸 HTML 电子邮件表格
【发布时间】:2018-04-26 13:17:20
【问题描述】:

我正在尝试创建响应式 HTML 电子邮件。两列的高度应该相等,并且它们目前在移动设备上堆叠。一切正常,直到有大量文本作为帐单信息或运输信息。文本看起来像这样是不太可能的情况,但我必须在不破坏电子邮件的情况下处理所有可能性。如何让我的 td 垂直而不是水平拉伸?我不能使用固定宽度,因为它会破坏我的桌子的响应能力。

<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnTextBlock" width="100%">
                                <tbody class="mcnTextBlockOuter">
                                    <tr>
                                        <td valign="top" width="100%" class="mcnTextBlockInner" style="padding-top:9px; padding-right:18px; padding-left: 18px; padding-bottom: 15px;">
                                            <!--[if mso]>
                                            <table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
                                            <tr>
                                            <![endif]-->

                                            <!--[if mso]>
                                            <td valign="top" width="600" style="width:600px;">
                                            <![endif]-->
                                            <table align="left" bgcolor="white" border="0" cellpadding="5" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer">
                                                <tbody>
                                                    <tr>
                                                        <td valign="top"  width="50%" class=" templateColumnContainer"">
                                                            <!--<td valign="top" width="300" class="mcnTextBlockInner" style="padding-top:9px;padding-right:18px;padding-left:18px;padding-bottom:15px;"> -->
                                                            <table border="0" cellpadding="5" cellspacing="0" width="100%" style="max-width:100%; min-width:100%;" class="mcnTextContentContainer">
                                                                <tr>
                                                                    <td valign="top" align="center" class="leftColumnContent" style="text-align: center;" >
                                                                        <span  style="color:#000000; font-size:18px; display: block; width:100%; height:auto;"><strong>Billing Information</strong></span>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td  valign="middle" class="leftColumnContent" style="text-align: center;">
                                                                        <span style="font-size:14px; color: #000000!important;"><a href="" style="color:#000000; text-decoration:none;">{{ receipt.order.get_billing_html|safe }}</a></span>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                      
                                                        <td valign="top" width="50%" class="templateColumnContainer">
                                                            <table border="0" cellpadding="5" cellspacing="0" width="100%">
                                                                <tr>
                                                                    <td class="rightColumnContent"  style="text-align: center;">
                                                                        <span style="font-size:18px; color:#000000; text-align:center; display: block; width:100%; height:auto;"><strong>Shipping Information</strong></span>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td valign="middle" class="rightColumnContent"  style="text-align: center;">
                                                                        <span>
                                                                            <a href="" style="color:#000000;font-size:14px; text-decoration:none;">Shipping Address</a>
                                                                        </span>
                                                                
                                                                            <br><span style="font-size:14px; color: #000000!important;">Shipping speed description
                                                                        {% endif %}
                                                                        {% if receipt.order.shipper_tracking_number %}
                                                                            <br><strong style="color: #000000;!important">Tracking: </strong>Shipper Name</span><br>
                                                                            
                                                                                <a href="shipping tracking number" target="_blank" style="color: #000000; font-size: 14px;">
                                                                                    
                                                                                </a>
                                                                         
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                   
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

【问题讨论】:

    标签: html email responsive


    【解决方案1】:

    在帖子中找到答案:HTML CSS How to stop a table cell from expanding

    &lt;td&gt; 上使用style="overflow-wrap: break-word;" 解决了我的问题。它与 Gmail、Apple Mail、Yahoo、最新的 Outlook 兼容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-23
      • 2015-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-26
      相关资源
      最近更新 更多