2016-05-30 50 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;一次.. –

相關問題