2015-12-09 3 views
1

Итак, я работаю над созданием новых шаблонов для моей компании, которые будут использоваться в широковещательных рассылках электронной почты, и у меня возникают проблемы с мобильными почтовыми клиентами. В частности, мой текст слишком мал в Android и iOS.Gmail в приложении Android/Default Mail на iOS сокращении текста

Теперь я могу использовать свой медиа-запрос для целевой iOS, если необходимо, и отрегулировать размер шрифта по своему усмотрению, но это невозможно, насколько я знаю для Android, оставляя меня с невероятно крошечным текстом.

Мой код ниже, основная часть, с которой я столкнулся, - это ячейка bodyleft, где размер шрифта составляет стандартный 16 пикселей и отлично выглядит везде, кроме мобильного. -webkit-text-size-adjust: none; не использовался, так как я хочу, чтобы размер корректировался, и в любом случае это не повлияло на это.

Любая помощь была бы высоко оценена, спасибо!

<style type="text/css"> 
td img { 
    display: block; 
} 
.ExternalClass * { 
    line-height: 100%; 
} 
@media screen and (max-width: 600px) { 
body[yahoo] .border { 
    width:98% !important; 
    min-width:auto !important; 
} 
body[yahoo] .main { 
    width:100% !important; 
} 
body[yahoo] .body { 
    width:90% !important; 
} 
body[yahoo] .spacer { 
    display: none !important; 
} 
body[yahoo] .footer { 
    width:90% !important; 
} 
body[yahoo] .bodyleft { 
    float: left; 
    margin-bottom: 20px; 
} 
body[yahoo] .bodyright { 
    float: left; 
    width:100% !important; 
} 
body[yahoo] img { 
    height: auto !important; 
} 
body[yahoo] .sideimagesa { 
    float:left; 
    width:48% !important; 
    margin-bottom:10px !important; 
} 
body[yahoo] .sideimagesb { 
    float:right; 
    width:48% !important; 
    margin-bottom:10px !important; 
} 
} 
</style> 
</head> 

<body yahoo="fix" style="margin:0px;" bgcolor="#EF9A9A"> 
<div> 
<table style="border-collapse:collapse;" width="100%" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
    <td bgcolor="#EF9A9A" style="padding-top:20px; padding-bottom:20px;"><table class="border" style="width:660px; min-width:660px; margin:auto; border-collapse:collapse;" border="0" align="center" cellpadding="5" cellspacing="0"> 
     <tr> 
     <td bgcolor="#F44336"> 
     <table class="main" style="width:650px; border-collapse:collapse;" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td bgcolor="#FFFFFF"> 
       <table class="main" style="width:650px; border-collapse:collapse;" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
      <td class="header" style="font-family:Arial, Helvetica, sans-serif;" align="center"><img style="display:block" src="http://images.theonlineimages.com/ima/650x200.jpg" alt="" width="100%" /></td> 
      </tr> 
      <tr> 
      <td class="headline" style="padding-top:15px; padding-bottom:15px;" align="center" bgcolor="#F44336"><strong><a style="font-family:Arial, Helvetica, sans-serif; font-size:24px; color:#ffffff; text-decoration:none;" href="http://en.wikipedia.org">This Can Be Your First Call to Action Link</a></strong></td> 
      </tr> 
      <tr> 
      <td style="padding-top:20px;"> 
<table class="body" style="width:625px; margin:auto; border-collapse:collapse;" border="0" align="center" cellpadding="0" cellspacing="0"> 
       <tr> 
       <td class="bodyleft" style="font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#212121; line-height:22px;" valign="top">Any text you want to include to explain what you are offering would be placed here. This includes any and all incentives. The text can be <strong>bolded</strong> or <em>italicized</em> for emphasis. Individual segments of text can also have their sizes and colors changed in order to add emphasis that way.<br /> 
        <br /> 
        <strong><span style="color:#B71C1C">Header Text</span></strong> <br /> 
        <br /> 
        You can use headers to separate your ideas, and have <a style="color:#B71C1C" href="#">hyperlinks</a> throughout your text. Pictures on the right side can be used to show off what you are advertising. Greater or fewer images can be included, and they can be switched to the left side if preferred. Images will be entered at the exact widths shown, but heights can vary without issue. 
        <br /> 
        <ul style="margin-top:19px;margin-bottom:19px;"> 
        <li>A bullleted or numbered list</li> 
        <li>can be used</li> 
        <li>to itemize your text</li> 
        </ul> 
        All colors are completely up to you. This includes links, text, borders and backgrounds. Each of these can be changed to whatever color you like.<br /> 
        <br /> 
        <table style="border-collapse:collapse;" class="cta" width="100%" border="0" cellspacing="0" cellpadding="10"> 
        <tr> 
         <td align="center" bgcolor="#F44336"><a style="font-family:Arial, Helvetica, sans-serif; font-size:36px; color:#ffffff; text-decoration:none; line-height:42px;" href="http://en.wikipedia.org"><strong>Press Here if You Want to 
         Learn More</strong></a></td> 
         </tr> 
        </table></td> 
       <td class="spacer" style="width:20px;">&nbsp;</td> 
       <td class="bodyright" style="width:210px;" valign="top"><table class="sideimagesa" border="0" cellpadding="5" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
        <td bgcolor="#F44336"><table style="width:100%; border-collapse:collapse;" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
         <td align="center" style="font-family:Arial, Helvetica, sans-serif;"><span class="header" style="font-family:Arial, Helvetica, sans-serif;"><img style="display:block" src="http://images.theonlineimages.com/ima/200x125.jpg" alt="" width="100%" /></span></td> 
         </tr> 
         </table></td> 
        </tr> 
        </table> 
        <table class="spacer" border="0" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
         <td height="20">&nbsp;</td> 
         </tr> 
        </table> 
        <table class="sideimagesb" border="0" cellpadding="5" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
         <td bgcolor="#F44336"><table style="width:100%; border-collapse:collapse;" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
          <td align="center" bgcolor="#BDBDBD" style="font-family:Arial, Helvetica, sans-serif;"><span class="header" style="font-family:Arial, Helvetica, sans-serif;"><img style="display:block" src="http://images.theonlineimages.com/ima/200x125.jpg" alt="" width="100%" /></span></td> 
          </tr> 
         </table></td> 
         </tr> 
        </table> 
        <table class="spacer" border="0" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
         <td height="20">&nbsp;</td> 
         </tr> 
        </table> 
        <table class="sideimagesa" border="0" cellpadding="5" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
         <td bgcolor="#F44336"><table style="width:100%; border-collapse:collapse;" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
          <td align="center" bgcolor="#BDBDBD" style="font-family:Arial, Helvetica, sans-serif;"><span class="header" style="font-family:Arial, Helvetica, sans-serif;"><img style="display:block" src="http://images.theonlineimages.com/ima/200x125.jpg" alt="" width="100%" /></span></td> 
          </tr> 
         </table></td> 
         </tr> 
        </table> 
        <table class="spacer" border="0" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
         <td height="20">&nbsp;</td> 
         </tr> 
        </table> 
        <table class="sideimagesb" border="0" cellpadding="5" cellspacing="0" style="width:100%; border-collapse:collapse;"> 
        <tr> 
         <td bgcolor="#F44336"><table style="width:100%; border-collapse:collapse;" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
          <td align="center" bgcolor="#BDBDBD" style="font-family:Arial, Helvetica, sans-serif;"><span class="header" style="font-family:Arial, Helvetica, sans-serif;"><img style="display:block" src="http://images.theonlineimages.com/ima/200x125.jpg" alt="" width="100%" /></span></td> 
          </tr> 
         </table></td> 
         </tr> 
        </table></td> 
       </tr> 
       </table></td> 
      </tr> 
      <tr> 
      <td style="padding-top:20px; padding-bottom:20px;"><table class="footer" style="width:625px; margin:auto; border-collapse:collapse;" border="0" align="center" cellpadding="0" cellspacing="0"> 
       <tr> 
       <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#212121" align="center">You can put disclaimers, contact info, or any other footer information you might want to include here</td> 
       </tr> 
       </table></td> 
      </tr> 
     </table> 
       </td> 
      </tr> 
      </table> 

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

</body> 
</html> 

Screenshot of the tiny text in Gmail

ответ

1

Проблема с Gmail, что вы имеете не имеет ничего общего с размером шрифта или типа декларации шрифта. Фактически, использование EM или ключевых слов, как показано в предыдущем ответе, может нарушить ваш дизайн/макет, поскольку они непоследовательны по отношению к клиентам (размер по умолчанию варьируется - см. Поддерживающий ответ здесь: In email templates, should font-size be in pt or px?).

Проблема в том, что у вас объявленная ширина 660 пикселей, которая намного шире, чем у телефона, поэтому чтобы она соответствовала экрану и не требовала горизонтальной прокрутки, она «масштабирует» сообщение электронной почты, сокращая все элементы в вашей электронной почте. Gmail игнорирует все, что указано в таблице стилей, что означает, что все медиа-запросы становятся бесполезными.

Чтобы предотвратить это, вы должны создать в первой мобильной среде, используя проценты, а затем использовать медиа-запросы и т. Д., Чтобы приспособить ее к настольному компьютеру.

Хороший ресурс на этом типе электронной почты: http://labs.actionrocket.co/the-hybrid-coding-approach-2

Хороший ресурс на приемлемом CSS: https://www.campaignmonitor.com/css

Codepen из примера кода: http://codepen.io/actionrocket/pen/EoCLH

<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ededed"> 
    <tr> 
    <td> 

    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style=" display:block; max-width:640px !important;" bgcolor="#ffffff"> 
     <tr> 
     <td> 

     <table id="holder" class="wrapper" border="0" cellspacing="0" cellpadding="0" style="width:100%; max-width:640px !important;" align="center"> 
     <tr><td align="center"> 
     <!--[if mso]> 
      <table id="outlookholder" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td> 
     <![endif]--> 
     <!--[if (IE)]> 
      <table border="0" cellspacing="0" cellpadding="0" width="640" align="center"><tr><td> 
     <![endif]--> 


     <!--2 column--> 
     <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
      <td> 
      <table width="320" border="0" cellspacing="0" cellpadding="0" align="left"> 
       <tr> 
        <td width="20"></td> 
        <td width="280" bgcolor="#ededed"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td align="center"><img style="display:block" border="0" src="http://placehold.it/100x100" width="100" height="100" alt=""/></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="2%"></td> 
         <td style="font-family:arial, Helvetica, sans-serif; font-size:22px; line-height:26px; color:#454545; text-align:center;">Module title goes here</td> 
         <td width="2%"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
        <td width="2%"></td> 
         <td style="font-family:arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#454545; text-align:center;">Praesent laoreet sem orci. Maecenas male neq nec sem gravida commodo.</td> 
         <td width="2%"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td align="center"> 
         <table width="160" border="0" cellspacing="0" cellpadding="0" class="w300" bgcolor="#a3a3a3"> 
          <tr> 
          <td width="15"></td> 
          <td style="font-family:arial, Helvetica, sans-serif; font-size:16px; line-height:20px; color:#ffffff; text-align:center;"> 
          <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
           <tr> 
           <td width="100%" height="10"></td> 
           </tr> 
          </table> 
           <a style="color:#FFFFFF; text-decoration:none;" href="#" target="_blank">Call to Action</a> 
           <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
           <tr> 
           <td width="100%" height="10"></td> 
           </tr> 
          </table> 
          </td> 
          <td width="15"></td> 
          </tr> 
         </table> 
         </td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20" bgcolor="#ffffff"></td> 
        </tr> 
        </table> 
        </td> 
        <td width="20"></td> 
       </tr> 
      </table> 
       <!--[if mso]></td><td><![endif]--> 
      <table width="320" border="0" cellspacing="0" cellpadding="0" > 
       <tr> 
        <td width="20"></td> 
        <td width="280" bgcolor="#ededed"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td align="center"><img style="display:block" border="0" src="http://placehold.it/100x100" width="100" height="100" alt=""/></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="2%"></td> 
         <td style="font-family:arial, Helvetica, sans-serif; font-size:22px; line-height:26px; color:#454545; text-align:center;">Module title goes here</td> 
         <td width="2%"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="2%"></td> 
         <td style="font-family:arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#454545; text-align:center;">Praesent laoreet sem orci. Maecenas male neq nec sem gravida commodo.</td> 
         <td width="2%"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td align="center"> 
         <table width="160" border="0" cellspacing="0" cellpadding="0" class="w300" bgcolor="#a3a3a3"> 
          <tr> 
          <td width="15"></td> 
          <td style="font-family:arial, Helvetica, sans-serif; font-size:16px; line-height:20px; color:#ffffff; text-align:center;"> 
          <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
           <tr> 
           <td width="100%" height="10"></td> 
           </tr> 
          </table> 
           <a style="color:#FFFFFF; text-decoration:none;" href="#" target="_blank">Call to Action</a> 
           <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
           <tr> 
           <td width="100%" height="10"></td> 
           </tr> 
          </table> 
          </td> 
          <td width="15"></td> 
          </tr> 
         </table> 
         </td> 
        </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
         <td width="100%" height="20"></td> 
        </tr> 
        </table> 
        </td> 
        <td width="20"></td> 
       </tr> 
      </table> 

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




       </td></tr></table> 
     <!--[if mso]> 
       </td></tr></table> 
     <![endif]--> 
     <!--[if IE]> 
       </td></tr></table> 
     <![endif]--> 



</td></tr></table> 
</td></tr></table> 
+0

Вы правы. Я упустил из виду, что ширина была 660 пикселей, знаете ли вы, какие почтовые клиенты не поддерживают EM и ключевые слова? До сих пор у меня никогда не было проблем с ними. – JoeyPhillips

+0

Это не значит, что они не поддерживаются, это значит, что нет согласованности. EM и проценты (а также ключевое слово) основаны на размере шрифта по умолчанию, объявленном каждым почтовым клиентом, что означает, что он не является стандартным, как в Интернете. Я не говорю, что вы не можете добиться успеха с EM и т. Д., Но настоятельно рекомендуется использовать PX. – Gortonington

+0

Большой совет, объявление ширины действительно было проблемой. Я попробовал заставить шаблон использовать только процентную ширину вместо этого и установить максимальную ширину, чтобы она не была слишком большой на рабочем столе, и она сработала. Выглядит уродливо, как черт возьми этот макет, так что мне придется возиться с некоторыми другими идеями макета, например, с одним столбцом. – humulos

Смежные вопросы