2016-05-30 51 views
0

下面的图片(情景A,情景B)从GMAIL应用程序获取相同的通讯。唯一的区别是方案B中突出显示的部分是图像。理想情况下,我需要场景B(其正确对齐并占用600像素宽度),但是如何使用文本本身实现它(如场景A中所示)?如何在gmail中使用文本获取全宽html电子邮件?

我面临的问题是它像一个移动布局被包裹,因为整个模板的宽度越来越小。

Scenario AScenario B

为场景A &方案B中的代码的差异

情形A:


<div style="background-color:#f6f4f5;padding:0;margin:0 auto;width:100%!important"> 
<div style="overflow:hidden;color:transparent;width:0;font-size:0;min-height:0"> 
</div> 
<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#f6f4f5" border="0" align="center" style="table-layout:fixed;font-family:Helvetica,Arial,sans-serif"> 
    <tbody> 
     <tr> 
      <td align="center"> 
       <center style="width:100%"> 
        <table width="580" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" style="margin:0 auto; max-width:580px; width:inherit; font-family:Helvetica,Arial,sans-serif"> 
         <tbody> 
          <tr> 
           <td width="100%" bgcolor="#F3F3F3" style="background-color:#f6f4f5;padding:12px;border-bottom:1px solid #ececec"> 
            <table width="100%" cellspacing="0" cellpadding="0" border="0" style="font-weight:200;width:100%!important;font-family:Helvetica,Arial,sans-serif;min-width:100%!important"> 
             <tbody> 
              <tr> 
               <td width="47%" valign="middle"> 
                <div> 
                 <a target="_blank" title="MyTechLogy" href="http://www.mytechlogy.com/"><img src="http://www.mytechlogy.com/view/images/MyTechLogy-Logo-TagLine-200.png" border="0" style="display:block;border:none;outline:none;text-decoration:none" title="MyTechLogy" alt="MyTechLogy"></a> 
                </div> 
               </td> 
               <td align="left" width="47%" valign="middle" style="padding:10px 0 10px 20px"> 
                <div> 
                 <img src="http://www.mytechlogy.com/upload/by_users/Bharath/241605103728ITcareerdevelopment.png" border="0" style="display:block; border:none; outline:none; text-decoration:none; height:60px;" title="Your Online Professional IT Career Development Platform." alt="Your Online Professional IT Career Development Platform."> 
                </div> 
               </td> 
              </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#29acc8" align="center" width="580"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle"> 
              <td width="100%" height="30" style="padding-left: 20px; font-family:Helvetica,Arial,sans-serif; font-size:16px; color:#ffffff;line-height:20px;vertical-align:middle;text-align:left;"><strong><span style="text-align:left;">Weekly Highlights from the Analytics Corner</span></strong></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:20px; color:#29acc8; line-height:28px; vertical-align:middle; padding-top:20px; padding-bottom:5px;padding-left:20px; padding-right:10px"> 
           <strong><a href="http://www.mytechlogy.com/IT-blogs/11037/how-to-ace-your-data-analytics-interview/" style="text-decoration: none !important;"><span style="color:#29acc8;">Tips to ace your Data Analytics Interview</span></a></strong> 
           </td> 
          </tr> 
          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:14px; color:#000000; line-height:20px; vertical-align:middle; padding-top:5px; padding-bottom:0px; padding-left:20px; padding-right:10px"> 
           I test drove the new Career Initiative feature at MyTechlogy and was pretty impressed by the kind of insights it threw up overnight. I think young professionals in data analytics or data science will find it helpful if they're looking for data that will help them make a decision about their own careers.. <a href="http://www.mytechlogy.com/IT-blogs/11037/how-to-ace-your-data-analytics-interview/"style="text-decoration: none !important;"><span style="font-family:Helvetica,Arial,sans-serif;font-size:14px;color:#29acc8;">Read more >></span></a> 
           </td> 
          </tr> 
          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:14px; color:#29acc8; line-height:28px; vertical-align:middle; padding-top:10px; padding-bottom:5px; padding-left:20px; padding-right:10px"> 
           <strong><span style="font-family:Helvetica,Arial,sans-serif;font-size:14px;color:#333333;line-height:28px;">Career Switch to Analytics?</span> <span style="font-family:Helvetica,Arial,sans-serif;font-size:14px;color:#333333;line-height:28px;"><a href="http://www.mytechlogy.com/my-page/?create_initiative=yes" style="text-decoration: none !important;"><span style="color:#29acc8;">See which IT skills can help you get there >></span></a></span></strong> 
           </td> 
          </tr> 
          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center" width="560"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle; "> 
              <td width="100%" height="10" ></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
          <tr> 
           <td style="padding-top:20px;"> 
            <div align="center">  
             <table align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" width="560"> 
              <tbody> 
              <tr> 
               <td width="560px" align="left" valign="middle" height="60" style=" text-align:left; background-color:#29acc8; font-size:21px; font-family:Helvetica, arial, sans-serif; color:#ffffff; font-weight: 300; padding-left:10px;"> 
                <span style="color: #ffffff; font-weight: 400;text-align:left"> 
                 <strong>IT Career Progression made easier with MyTechLogy</strong> 
                </span> 
               </td> 
              </tr> 
              </tbody> 
             </table> 
            </div> 
           </td> 
          </tr> 

          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center" width="560"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle;"> 
              <td width="100%" height="10"></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 

          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:14px; color:#000000; line-height:20px; vertical-align:middle; padding-top:5px; padding-bottom:10px; padding-left:20px; padding-right:10px"> 
           MyTechlogy provides personalized insights from industry data to help you stay relevant and to progress your IT career. 
           </td> 
          </tr> 

          <tr valign="middle" style="vertical-align:middle; "> 
           <td align="center" valign="middle" style="vertical-align:middle; "> 
             <a target="_blank" href="http://www.mytechlogy.com/my-page/?create_initiative=yes"><img width="540" border="0" height="163" alt="IT career progression has been made easier with MyTechLogy" style="display:block; border:none; outline:none; text-decoration:none;" src="http://www.mytechlogy.com/upload/by_users/Bharath/181605050426CareerProgression.png" class="bigimage"></a> 
            </td> 
          </tr> 
          <tr> 
           <td width="100%" height="10"></td> 
          </tr> 

          <tr> 
           <td> 
            <div align="center">  
             <a style="color: #ffffff; text-align:center;text-decoration: none;" href="http://www.mytechlogy.com/my-page/?create_initiative=yes"> 
              <table height="60" align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" class="tablet-button" st-button="edit"> 
               <tbody> 
               <tr align="center"> 
                <td width="auto" align="center" valign="middle" height="60" style=" background-color:#FF6600; border-top-left-radius:2px; border-bottom-left-radius:2px;border-top-right-radius:2px; border-bottom-right-radius:2px; background-clip: padding-box;font-size:22px; font-family:Helvetica, arial, sans-serif; text-align:center; color:#ffffff; font-weight: 300; padding-left:18px; padding-right:18px; box-shadow: 1px 5px 5px #888888;"> 

                 <span style="color: #ffffff; font-weight: 400;"> 
                  <a style="color: #ffffff; text-align:center;text-decoration: none;" href="http://www.mytechlogy.com/my-page/?create_initiative=yes"><strong>Create your Career Initiative Now!</strong></a> 
                 </span> 
                </td> 
               </tr> 
               </tbody> 
              </table> 
             </a> 
            </div> 
           </td> 
          </tr> 

          <tr> 
           <td width="100%" height="30"></td> 
          </tr> 
          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#29acc8" align="center" width="580"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle"> 
              <td width="100%" height="10"></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 

          <tr> 
           <td width="100%"> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#f6f4f5" align="center" width="580"> 
             <tbody> 

              <tr> 
               <td align="left" valign="middle" style="font-family:Calibri,sans-serif;font-size:11px;color:#666666;line-height:15px; padding-left:10px;padding-right:10px;"> 
                <div style="background-color:#f6f4f5;padding-top:20px;margin:0 auto;width:100%!important"> 
                To unsubscribe from receiving this email into future, click <a target="_blank" style="text-decoration:none;color:#0db9ea" href="[UNSUBSCRIBEURL]">unsubscribe</a> </div> 
               </td> 
              </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
         </tbody> 
        </table> 
       </center> 
      </td> 
     </tr> 
    </tbody> 
</table> 


方案B:


<div style="background-color:#f6f4f5;padding:0;margin:0 auto;width:100%!important"> 
<div style="overflow:hidden;color:transparent;width:0;font-size:0;min-height:0"> 
</div> 
<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#f6f4f5" border="0" align="center" style="table-layout:fixed;font-family:Helvetica,Arial,sans-serif"> 
    <tbody> 
     <tr> 
      <td align="center"> 
       <center style="width:100%"> 
        <table width="580" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" style="margin:0 auto; max-width:580px; width:inherit; font-family:Helvetica,Arial,sans-serif"> 
         <tbody> 
          <tr> 
           <td width="100%" bgcolor="#F3F3F3" style="background-color:#f6f4f5;padding:12px;border-bottom:1px solid #ececec"> 
            <table width="100%" cellspacing="0" cellpadding="0" border="0" style="font-weight:200;width:100%!important;font-family:Helvetica,Arial,sans-serif;min-width:100%!important"> 
             <tbody> 
              <tr> 
               <td width="47%" valign="middle"> 
                <div> 
                 <a target="_blank" title="MyTechLogy" href="http://www.mytechlogy.com/"><img src="http://www.mytechlogy.com/view/images/MyTechLogy-Logo-TagLine-200.png" border="0" style="display:block;border:none;outline:none;text-decoration:none" title="MyTechLogy" alt="MyTechLogy"></a> 
                </div> 
               </td> 
               <td align="left" width="340" valign="middle" style="padding:10px 0 10px 10px"> 
                <div> <span style="font-family:Helvetica,Arial,sans-serif; font-size:20px; color:#333333; line-height:28px; vertical-align:middle;">Your Online Professional<br />IT Career Development Platform.</span> 
                </div> 
               </td> 
              </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#29acc8" align="center" width="580"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle"> 
              <td width="100%" height="30" style="padding-left: 20px; font-family:Helvetica,Arial,sans-serif; font-size:16px; color:#ffffff;line-height:20px;vertical-align:middle;text-align:left;"><strong><span style="text-align:left;">Weekly Highlights from the Analytics Corner</span></strong></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:20px; color:#29acc8; line-height:28px; vertical-align:middle; padding-top:20px; padding-bottom:5px;padding-left:20px; padding-right:10px"> 
           <strong><a href="http://www.mytechlogy.com/IT-blogs/11037/how-to-ace-your-data-analytics-interview/" style="text-decoration: none !important;"><span style="color:#29acc8;">Tips to ace your Data Analytics Interview</span></a></strong> 
           </td> 
          </tr> 
          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:14px; color:#000000; line-height:20px; vertical-align:middle; padding-top:5px; padding-bottom:0px; padding-left:20px; padding-right:10px"> 
           I test drove the new Career Initiative feature at MyTechlogy and was pretty impressed by the kind of insights it threw up overnight. I think young professionals in data analytics or data science will find it helpful if they're looking for data that will help them make a decision about their own careers.. <a href="http://www.mytechlogy.com/IT-blogs/11037/how-to-ace-your-data-analytics-interview/"style="text-decoration: none !important;"><span style="font-family:Helvetica,Arial,sans-serif;font-size:14px;color:#29acc8;">Read more >></span></a> 
           </td> 
          </tr> 
          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:14px; color:#29acc8; line-height:28px; vertical-align:middle; padding-top:10px; padding-bottom:5px; padding-left:20px; padding-right:10px"> 
           <strong><span style="font-family:Helvetica,Arial,sans-serif;font-size:14px;color:#333333;line-height:28px;">Career Switch to Analytics?</span> <span style="font-family:Helvetica,Arial,sans-serif;font-size:14px;color:#333333;line-height:28px;"><a href="http://www.mytechlogy.com/my-page/?create_initiative=yes" style="text-decoration: none !important;"><span style="color:#29acc8;">See which IT skills can help you get there >></span></a></span></strong> 
           </td> 
          </tr> 
          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center" width="560"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle; "> 
              <td width="100%" height="10" ></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
          <tr> 
           <td style="padding-top:20px;"> 
            <div align="center">  
             <table align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" width="560"> 
              <tbody> 
              <tr> 
               <td width="560px" align="left" valign="middle" height="60" style=" text-align:left; background-color:#29acc8; font-size:21px; font-family:Helvetica, arial, sans-serif; color:#ffffff; font-weight: 300; padding-left:10px;"> 
                <span style="color: #ffffff; font-weight: 400;text-align:left"> 
                 <strong>IT Career Progression made easier with MyTechLogy</strong> 
                </span> 
               </td> 
              </tr> 
              </tbody> 
             </table> 
            </div> 
           </td> 
          </tr> 

          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center" width="560"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle;"> 
              <td width="100%" height="10"></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 

          <tr valign="middle" style="vertical-align:middle"> 
           <td align="left" width="560" valign="middle" style="font-family:Helvetica,Arial,sans-serif; font-size:14px; color:#000000; line-height:20px; vertical-align:middle; padding-top:5px; padding-bottom:10px; padding-left:20px; padding-right:10px"> 
           MyTechlogy provides personalized insights from industry data to help you stay relevant and to progress your IT career. 
           </td> 
          </tr> 

          <tr valign="middle" style="vertical-align:middle; "> 
           <td align="center" valign="middle" style="vertical-align:middle; "> 
             <a target="_blank" href="http://www.mytechlogy.com/my-page/?create_initiative=yes"><img width="540" border="0" height="163" alt="IT career progression has been made easier with MyTechLogy" style="display:block; border:none; outline:none; text-decoration:none;" src="http://www.mytechlogy.com/upload/by_users/Bharath/181605050426CareerProgression.png" class="bigimage"></a> 
            </td> 
          </tr> 
          <tr> 
           <td width="100%" height="10"></td> 
          </tr> 

          <tr> 
           <td> 
            <div align="center">  
             <a style="color: #ffffff; text-align:center;text-decoration: none;" href="http://www.mytechlogy.com/my-page/?create_initiative=yes"> 
              <table height="60" align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" class="tablet-button" st-button="edit"> 
               <tbody> 
               <tr align="center"> 
                <td width="auto" align="center" valign="middle" height="60" style=" background-color:#FF6600; border-top-left-radius:2px; border-bottom-left-radius:2px;border-top-right-radius:2px; border-bottom-right-radius:2px; background-clip: padding-box;font-size:22px; font-family:Helvetica, arial, sans-serif; text-align:center; color:#ffffff; font-weight: 300; padding-left:18px; padding-right:18px; box-shadow: 1px 5px 5px #888888;"> 

                 <span style="color: #ffffff; font-weight: 400;"> 
                  <a style="color: #ffffff; text-align:center;text-decoration: none;" href="http://www.mytechlogy.com/my-page/?create_initiative=yes"><strong>Create your Career Initiative Now!</strong></a> 
                 </span> 
                </td> 
               </tr> 
               </tbody> 
              </table> 
             </a> 
            </div> 
           </td> 
          </tr> 

          <tr> 
           <td width="100%" height="30"></td> 
          </tr> 
          <tr> 
           <td> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#29acc8" align="center" width="580"> 
             <tbody> 
             <tr valign="middle" style="vertical-align:middle"> 
              <td width="100%" height="10"></td> 
             </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 

          <tr> 
           <td width="100%"> 
            <table cellspacing="0" cellpadding="0" border="0" bgcolor="#f6f4f5" align="center" width="580"> 
             <tbody> 

              <tr> 
               <td align="left" valign="middle" style="font-family:Calibri,sans-serif;font-size:11px;color:#666666;line-height:15px; padding-left:10px;padding-right:10px;"> 
                <div style="background-color:#f6f4f5;padding-top:20px;margin:0 auto;width:100%!important"> 
                To unsubscribe from receiving this email into future, click <a target="_blank" style="text-decoration:none;color:#0db9ea" href="[UNSUBSCRIBEURL]">unsubscribe</a> </div> 
               </td> 
              </tr> 
             </tbody> 
            </table> 
           </td> 
          </tr> 
         </tbody> 
        </table> 
       </center> 
      </td> 
     </tr> 
    </tbody> 
</table> 


请帮助我怎样才能解决这个问题。

回答

0

这些td应放置在宽度为600px的表格内,并且应将其放置在100%宽的表格内。 希望这有助于。否则,请张贴更多的代码,以便我们调整它。

+0

我已经更新上面的代码,供大家参考。希望有所帮助。 – Technoholic

0

请使用如下代码:

<table align=center" width="100%"> 
      <td align="left" width="48%" valign="middle" style="padding:10px 0 10px 10px;font-family:Helvetica,Arial,sans-serif; font-size:20px; color:#333333; line-height:28px; vertical-align:middle;"> 
    Your Online Professional<br />IT Career Development Platform. 
    </td> 
<td align="left" width="48%" valign="middle" style="padding:10px 0 10px 10px"><img src="http://www.mytechlogy.com/upload/by_users/Bharath/241605103728ITcareerdevelopment.png" border="0" style="display:block; border:none; outline:none; text-decoration:none; height:60px;" title="Your Online Professional IT Career Development Platform." alt="Your Online Professional IT Career Development Platform."></td> 
</table> 
+0

谢谢你的代码。它没有工作。 gmail移动应用程序的结果仍然相同。 – Technoholic

+0

将宽度替换为600px;一次.. –

相关问题