2014-05-21 41 views
2

當我使用聯繫人表單時,我正在從我的網站發送一封HTML電子郵件,並且通過我所做的所有測試,我設法克服了很多錯誤,但儘管有很多嘗試和大量的搜索周圍,我似乎無法設法讓我的電子郵件在iPhone的100%的寬度。iPhone郵件100%寬度

這裏的問題的截圖:http://i62.tinypic.com/2r6mh5y.png

而且這裏是我使用的代碼的副本:

<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <meta name="format-detection" content="telephone=no"> 
     <title></title> 
     <style type="text/css"> 
      html, body { width: 100% !important; } 
      p { font-family: Arial; } 
      a { font-family: Arial; } 
      td { font-family: Arial; } 
     </style> 
    </head> 
    <body bgcolor="#000000" style="font-family:Arial; min-width:100%; background-color:#000000; margin:0; padding:0;" topmargin="0"> 
     <table width="100%" bgcolor="#000000" style="width:100%; background-color:#000000; background-image:url(http://newsite.moninfolettre.ca/images/courriel/top_bg.jpg); background-position:center top; background-repeat:repeat repeat;" border="0" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td>&nbsp;</td> 
       <td width="600" height="130" align="center" valign="middle"> 
        <img src="http://newsite.moninfolettre.ca/images/courriel/logo_courriel.png" alt="Geant du web - Infolettre" width="168" height="61" style="font-size:18px; font-family:Arial; color:#FFFFFF;" /> 
       </td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 
     <table width="100%" bgcolor="#CD0C11" style="width:100%; background-color:#CD0C11" border="0" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td height="4" style="font-size:1px;-webkit-text-adjust:none;">&nbsp;</td> 
      </tr> 
     </table> 

     <table width="100%" bgcolor="#F2F2F2" style="width:100%; background-image:url(http://newsite.moninfolettre.ca/images/courriel/shadow.jpg); background-position:center top; background-repeat:repeat no-repeat; background-color:#F2F2F2" border="0" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td>&nbsp;</td> 
       <td width="520"> 
        <table> 
         <tr> 
          <td style="font-size:32px; padding:20px 0 0; white-space:nowrap;">Votre transaction est</td> 
         </tr> 
         <tr> 
          <td style="font-size:32px; font-weight:900; color:#E30512; padding:0 0 15px; white-space:nowrap;"> 
           complétée avec succès !! 
          </td> 
         </tr> 
        </table> 
       </td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 
     <table width="100%" bgcolor="#FFFFFF" style="width:100%; background-color:#FFFFFF" border="0" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td>&nbsp;</td> 
       <td width="520" style="padding:20px 0 0; color:#5A5A5A"> 
        <p style="margin:0 0 20px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> 
        <p style="margin:20px 0;">Praesent nulla felis, malesuada eu sapien vitae, pretium dictum dolor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam faucibus dui in est euismod, at sollicitudin elit aliquam. Nulla augue ante, tincidunt vel sodales id, tincidunt non nibh.</p> 
        <p style="margin:20px 0;">In hac habitasse platea dictumst. Aliquam feugiat aliquam tortor, id vestibulum dui rutrum vel. Nulla tincidunt, tortor vitae iaculis scelerisque, ipsum augue gravida ipsum, ac faucibus mauris urna et tortor.</p> 
        <p style="margin:20px 0;">Duis luctus pretium turpis, sed iaculis mauris commodo at. Aliquam dictum venenatis enim et tincidunt. In hac habitasse platea dictumst. Sed viverra laoreet neque, vel sodales tellus luctus vitae.</p> 
        <p style="margin:20px 0;">Merci d'avoir fait confiance à <strong style="font-weight:900;">GÉANT DU WEB !</strong></p> 
       </td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 
     <table width="100%" bgcolor="#F2F2F2" style="width:100%; background-color:#F2F2F2" border="0" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td>&nbsp;</td> 
       <td width="600"> 
        <table width="100%" border="0" cellpadding="0" cellspacing="0"> 
         <tr> 
          <td width="40">&nbsp;</td> 
          <td width="260" style="padding:30px 0 20px;"> 
           <table> 
            <tr> 
             <td style="padding:0 0 10px;">Accèdez dès maintenant à</td> 
            </tr> 
            <tr> 
             <td> 
              <table width="165" height="35" bgcolor="#E30512" style="width:165px; background-color:#E30512; border-radius:10px;"> 
               <tr> 
                <td align="center" valign="middle" style="font-size:14px; font-weight:900; text-transform:uppercase;"> 
                 <a href="#" style="text-decoration:none; color:#FFFFFF;">Votre compte</a> 
                </td> 
               </tr> 
              </table> 
             </td> 
            </tr> 
            <tr> 
             <td style="padding:20px 0 10px;">ou contactez notre équipe:</td> 
            </tr> 
            <tr> 
             <td style="color:#5A5A5A;">Sans frais</td> 
            </tr> 
            <tr> 
             <td style="font-size:24px; font-weight:900; color: #E30512; line-height:100%; padding:0 0 10px;">1-888-86-GÉANT</td> 
            </tr> 
            <tr> 
             <td style="color:#5A5A5A;">Montréal</td> 
            </tr> 
            <tr> 
             <td style="font-size:24px; font-weight:900; color: #E30512; line-height:100%; padding:0 0 20px;">(514) 359-2949</td> 
            </tr> 
            <tr> 
             <td>Besoin de <a href="#" style="font-weight:bold; color:#000000;">Support en ligne</a> ?</td> 
            </tr> 
           </table> 
          </td> 
          <td width="300" valign="bottom" style="padding:0px;"> 
           <img src="http://newsite.moninfolettre.ca/images/courriel/robot.jpg" alt="" style="display:block;" width="300" height="280" /> 
          </td> 
         </tr> 
        </table> 
       </td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 

     <table width="100%" bgcolor="#000000" style="width:100%; background-color:#000000; background-image:url(http://newsite.moninfolettre.ca/images/courriel/bottom_bg.jpg); background-position:center top; background-repeat:repeat repeat;" border="0" cellpadding="0" cellspacing="0"> 
      <tr> 
       <td>&nbsp;</td> 
       <td width="600" height="100" align="center" valign="middle"> 
        <a href="www.moninfolettre.ca" style="font-size:24px; text-decoration:none; text-transform:uppercase; color:#FFFFFF;"> 
         <span style="color:#FFFFFF;">www.moninfolettre.ca</span> 
        </a> 
       </td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 
    </body> 
</html> 
+0

問題是上圖:http://newsite.moninfolettre.ca/images/courriel/robot.jpg - 使圖像響應或給小尺寸 –

+0

@LuisP。一個。只是嘗試了這一點,它修復了一個錯誤,該圖像會溢出佈局,但電子郵件仍然不會佔用100%的寬度。 – Chaosxmk

+0

我有完全相同的問題...除了添加媒體查詢的整個贓物和設置包裝表的像素寬度,還有其他解決方案嗎?媒體查詢路線不太友好。 – nickspiel

回答

0

移動Safari瀏覽器的默認視口寬度爲980px,所以它使用980px的寬度包含您的div的元素。這就是您的佈局損壞的原因。 您可以修復此設置視口,或者通過添加最小寬度:您的設計的「身體寬度」(像素);給你的身體。 Mobile Safari將使用最小寬度的值來設置其視口。

設置視口

<meta name="viewport" content="width=device-width, initial-scale=1.0" /> 
+0

剛剛嘗試過,沒有發現明顯的變化,即使是與Luis P.A. – Chaosxmk

+0

是不是最小寬度的工作呢?不要設置min-width:100%,但是min-width:something-px; – faby

+0

這對視窗小於980像素的設備是否會造成問題? – Chaosxmk

0

要具有100%的寬度的任何元件,增加一個addtional基於min-width

例如一個像素:

width: 100%; 
min-width: 600px; 

或者內聯<table style="min-width: 600px; width: 100%;" width="100%">

我雙倍寬度attrib只爲了那個額外的保證人。你只是永遠不知道... :)