什么会导致嵌套表中的换行但仅在Outlook中引起换行?

时间:2018-08-08 13:49:47

标签: html-email

这应该是这样的: enter image description here

这是Outlook中的外观:

enter image description here

由于某种原因,“致电给我们”表被推到下面的下一行,而不是停留在行内。我尝试在tr / td上放置“ white-space:nowrap”,但这似乎无法解决我的问题。

下面是标记:

                <tr>
                    <td>
                        <table id="border-1" align="left" style="border-top: 4px solid #444; border-left: 4px solid #444;" border="0" cellpadding="0" cellspacing="0" class="100p" width="50%"> <!--- Email Us Housing -->
                            <tr style="white-space: nowrap;">
                                <td style="white-space: nowrap;">

                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr style="white-space: nowrap;">
                                            <td style="white-space: nowrap;">

                                                <table align="left" border="0" cellpadding="0" cellspacing="0" width="50%" >
                                                  <tr style="white-space: nowrap;">
                                                      <td style="white-space: nowrap;">

                                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                           <tr style="white-space: nowrap;">
                                                               <td style="padding: 10px; text-align: center; white-space: nowrap;">
                                                                   <a href="mailto:sales@bambams.com?Subject=Hello!" target="_top" style="text-decoration:none;"><img width="50" src="mail.png" alt="Send Us An Email"></a>
                                                               </td>
                                                           </tr>

                                                        </table> 
                                                      </td>
                                                  </tr>
                                                </table>

                                                <table align="right" border="0" cellpadding="0" cellspacing="0" width="50%">
                                                    <tr style="white-space: nowrap;">
                                                        <td style="white-space: nowrap; font-size:24px; color:#414042; font-family: Open Sans, Helvetica, Arial, sans-serif; text-transform: uppercase;" class="link-bump"  height="70"><a href="mailto:sales@bambams.com?Subject=Hello!" target="_top" style="color:#414042; text-decoration:none;">email us</a></td>
                                                    </tr>
                                                </table>  
                                            </td>
                                        </tr>

                                    </table>

                                </td>
                            </tr>

                        </table>

                        <table id="border-2" align="right" style="border-top: 4px solid #444; border-right: 4px solid #444;" border="0" cellpadding="0" cellspacing="0" class="100p" width="50%">  <!--- call Us Housing -->
                           <tr style="white-space: nowrap;">
                               <td style="white-space: nowrap;">

                                 <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                     <tr style="white-space: nowrap;">
                                         <td style="white-space: nowrap;">

                                           <table align="left" border="0" cellpadding="0" cellspacing="0" width="50%" >
                                              <tr style="white-space: nowrap;">
                                                  <td style="white-space: nowrap;">

                                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                       <tr style="white-space: nowrap;">
                                                           <td style=" white-space: nowrap; padding: 10px; text-align: center;">
                                                               <a href="tel:703-372-1940" style="color:#414042; text-decoration:none;"><img width="50" src="call.png" alt="Call Us"></a>
                                                           </td>
                                                       </tr>

                                                    </table>

                                                  </td> 
                                              </tr>


                                           </table>

                                           <table align="right" border="0" cellpadding="0" cellspacing="0" width="50%">
                                              <tr>
                                                <td style="font-size:24px; color:#414042; font-family: Open Sans, Helvetica, Arial, sans-serif; text-transform: uppercase;" class="link-bump"  height="70"> <a href="tel:703-372-1940" style="color:#414042; text-decoration:none;">call us</a></td>
                                              </tr>


                                                </table>
                                       </td>

                                    </tr>

                                </table>

                               </td>
                           </tr>

                        </table>
                    </td>
                </tr><!---- top footer end --->  


            </table>  

2 个答案:

答案 0 :(得分:1)

您可以尝试使用Outlook条件代码,因为这仅仅是一个Outlook Windows问题。然后将其定位到您的尺寸。

> Failed to execute goal
> org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument (default-cli)
> on project addressbook: Execution default-cli of goal
> org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument failed: Plugin
> org.codehaus.mojo:cobertura-maven-plugin:2.7 or one of its
> dependencies could not be resolved: Could not find artifact
> com.sun:tools:jar:0 at specified path
> /var/lib/jenkins/tools/hudson.model.JDK/myjava/../lib/tools.jar ->
> [Help 1]

答案 1 :(得分:0)

您可以通过添加幻影列来尝试理查德的建议

<!--[if (gte mso 9)|(IE)]></td><td><![endif]-->

或者您可以尝试执行以下类似操作:

 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <td bgcolor="#444444" style="padding:4px;">
        
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tbody>
                <tr>
                  <td bgcolor="#ffffff">
                    
                            <table id="border-1" align="left" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" border="0" cellpadding="0" cellspacing="0" class="100p" width="50%"> <!--- Email Us Housing -->
                            <tr style="white-space: nowrap;">
                                <td style="white-space: nowrap;">

                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr style="white-space: nowrap;">
                                            <td style="white-space: nowrap;">

                                                <table align="left" border="0" cellpadding="0" cellspacing="0" width="50%" >
                                                  <tr style="white-space: nowrap;">
                                                      <td style="white-space: nowrap;">

                                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                           <tr style="white-space: nowrap;">
                                                               <td style="padding: 10px; text-align: center; white-space: nowrap;">
                                                                   <a href="mailto:sales@bambams.com?Subject=Hello!" target="_top" style="text-decoration:none;"><img width="50" src="mail.png" alt="Send Us An Email"></a>
                                                               </td>
                                                           </tr>

                                                        </table> 
                                                      </td>
                                                  </tr>
                                                </table>

                                                <table align="right" border="0" cellpadding="0" cellspacing="0" width="50%">
                                                    <tr style="white-space: nowrap;">
                                                        <td style="white-space: nowrap; font-size:24px; color:#414042; font-family: Open Sans, Helvetica, Arial, sans-serif; text-transform: uppercase;" class="link-bump"  height="70"><a href="mailto:sales@bambams.com?Subject=Hello!" target="_top" style="color:#414042; text-decoration:none;">email us</a></td>
                                                    </tr>
                                                </table>  
                                            </td>
                                        </tr>

                                    </table>

                                </td>
                            </tr>

                        </table>

                        <table id="border-2" align="right" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" border="0" cellpadding="0" cellspacing="0" class="100p" width="50%">  <!--- call Us Housing -->
                           <tr style="white-space: nowrap;">
                               <td style="white-space: nowrap;">

                                 <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                     <tr style="white-space: nowrap;">
                                         <td style="white-space: nowrap;">

                                           <table align="left" border="0" cellpadding="0" cellspacing="0" width="50%" >
                                              <tr style="white-space: nowrap;">
                                                  <td style="white-space: nowrap;">

                                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                       <tr style="white-space: nowrap;">
                                                           <td style=" white-space: nowrap; padding: 10px; text-align: center;">
                                                               <a href="tel:703-372-1940" style="color:#414042; text-decoration:none;"><img width="50" src="call.png" alt="Call Us"></a>
                                                           </td>
                                                       </tr>

                                                    </table>

                                                  </td> 
                                              </tr>


                                           </table>

                                           <table align="right" border="0" cellpadding="0" cellspacing="0" width="50%">
                                              <tr>
                                                <td style="font-size:24px; color:#414042; font-family: Open Sans, Helvetica, Arial, sans-serif; text-transform: uppercase;" class="link-bump"  height="70"> <a href="tel:703-372-1940" style="color:#414042; text-decoration:none;">call us</a></td>
                                              </tr>


                                                </table>
                                       </td>

                                    </tr>

                                </table>

                               </td>
                           </tr>

                        </table>
                    
                    
                    </td>
                </tr>
              </tbody>
            </table>



        
      </td>
    </tr>
  </tbody>
</table>

我在您拥有的两个块周围添加了填充为4px的表,并向表中添加了CSS,使您可以在Outlook中并排放置表:

border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;

如果这不起作用,您可以将两列的宽度减小到49%,并且应该可以正常工作。

注意:如果您使用上面的代码,请减小宽度。

希望以上帮助。