2017-08-07 23 views
0

我正在創建一個響應式電子郵件模板。我的電子郵件表上未顯示邊框半徑

我想給白色內容區域border-radius: 5px;。邊界半徑在桌子的底部角落工作,但不會顯示在頂部角落。

任何想法是怎麼回事?

下面是一個代碼筆哪一個更容易看到活動的模板: https://codepen.io/thecashbag/pen/jLyQoa

附:這是一個電子郵件模板。不熟悉電子郵件的網頁設計師會討厭這種基於表格的代碼,但它是電子郵件客戶端正確顯示所必需的。

<!DOCTYPE html> 
 
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> 
 
<head> 
 
    <meta charset="utf-8"> <!-- utf-8 works for most cases --> 
 
    <meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldn't be necessary --> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine --> 
 
    <meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely --> 
 
    <title></title> <!-- The title tag shows in email notifications, like Android 4.4. --> 
 

 
    <!-- Web Font/@font-face : BEGIN --> 
 
    <!-- NOTE: If web fonts are not required, lines 10 - 27 can be safely removed. --> 
 

 
    <!-- Desktop Outlook chokes on web font references and defaults to Times New Roman, so we force a safe fallback font. --> 
 
    <!--[if mso]> 
 
     <style> 
 
      * { 
 
       font-family: sans-serif !important; 
 
      } 
 
     </style> 
 
    <![endif]--> 
 

 
    <!-- All other clients get the webfont reference; some will render the font and others will silently fail to the fallbacks. More on that here: http://stylecampaign.com/blog/2015/02/webfont-support-in-email/ --> 
 
    <!--[if !mso]><!--> 
 
     <!-- insert web font reference, eg: <link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'> --> 
 
    <!--<![endif]--> 
 

 
    <!-- Web Font/@font-face : END --> 
 

 
    <!-- CSS Reset --> 
 
    <style> 
 

 
     /* What it does: Remove spaces around the email design added by some email clients. */ 
 
     /* Beware: It can remove the padding/margin and add a background color to the compose a reply window. */ 
 
     html, 
 
     body { 
 
      margin: 0 auto !important; 
 
      padding: 0 !important; 
 
      height: 100% !important; 
 
      width: 100% !important; 
 
     } 
 

 
     /* What it does: Stops email clients resizing small text. */ 
 
     * { 
 
      -ms-text-size-adjust: 100%; 
 
      -webkit-text-size-adjust: 100%; 
 
     } 
 

 
     /* What it does: Centers email on Android 4.4 */ 
 
     div[style*="margin: 16px 0"] { 
 
      margin:0 !important; 
 
     } 
 

 
     /* What it does: Stops Outlook from adding extra spacing to tables. */ 
 
     table, 
 
     td { 
 
      mso-table-lspace: 0pt !important; 
 
      mso-table-rspace: 0pt !important; 
 
     } 
 

 
     /* What it does: Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */ 
 
     table { 
 
      border-spacing: 0 !important; 
 
      border-collapse: collapse !important; 
 
      table-layout: fixed !important; 
 
      margin: 0 auto !important; 
 
     } 
 
     table table table { 
 
      table-layout: auto; 
 
     } 
 

 
     /* What it does: Uses a better rendering method when resizing images in IE. */ 
 
     img { 
 
      -ms-interpolation-mode:bicubic; 
 
     } 
 

 
     /* What it does: A work-around for email clients meddling in triggered links. */ 
 
     *[x-apple-data-detectors], \t /* iOS */ 
 
     .x-gmail-data-detectors, \t /* Gmail */ 
 
     .x-gmail-data-detectors *, 
 
     .aBn { 
 
      border-bottom: 0 !important; 
 
      cursor: default !important; 
 
      /*color: inherit !important;*/ 
 
      text-decoration: none !important; 
 
      font-size: inherit !important; 
 
      font-family: inherit !important; 
 
      font-weight: inherit !important; 
 
      line-height: inherit !important; 
 
     } 
 

 
     /* What it does: Prevents Gmail from displaying an download button on large, non-linked images. */ 
 
     .a6S { 
 
      display: none !important; 
 
      opacity: 0.01 !important; 
 
     } 
 
     /* If the above doesn't work, add a .g-img class to any image in question. */ 
 
     img.g-img + div { 
 
      display:none !important; 
 
      } 
 

 
     /* What it does: Prevents underlining the button text in Windows 10 */ 
 
     .button-link { 
 
      text-decoration: none !important; 
 
     } 
 

 
     /* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */ 
 
     /* Create one of these media queries for each additional viewport size you'd like to fix */ 
 
     /* Thanks to Eric Lepetit @ericlepetitsf) for help troubleshooting */ 
 
     @media only screen and (min-device-width: 375px) and (max-device-width: 413px) { /* iPhone 6 and 6+ */ 
 
      .email-container { 
 
       min-width: 375px !important; 
 
      } 
 
     } 
 

 
    </style> 
 

 
    <!-- Progressive Enhancements --> 
 
    <style> 
 

 
     /* What it does: Hover styles for buttons */ 
 
     .button-td, 
 
     .button-a { 
 
      transition: all 100ms ease-in; 
 
     } 
 
     .button-td:hover, 
 
     .button-a:hover { 
 
      background: #555555 !important; 
 
      border-color: #555555 !important; 
 
     } 
 

 
     /* Media Queries */ 
 
     @media screen and (max-width: 480px) { 
 

 
      /* What it does: Forces elements to resize to the full width of their container. Useful for resizing images beyond their max-width. */ 
 
      .fluid { 
 
       width: 100% !important; 
 
       max-width: 100% !important; 
 
       height: auto !important; 
 
       margin-left: auto !important; 
 
       margin-right: auto !important; 
 
      } 
 

 
      /* What it does: Forces table cells into full-width rows. */ 
 
      .stack-column, 
 
      .stack-column-center { 
 
       display: block !important; 
 
       width: 100% !important; 
 
       max-width: 100% !important; 
 
       direction: ltr !important; 
 
      } 
 
      /* And center justify these ones. */ 
 
      .stack-column-center { 
 
       text-align: center !important; 
 
      } 
 

 
      /* What it does: Generic utility class for centering. Useful for images, buttons, and nested tables. */ 
 
      .center-on-narrow { 
 
       text-align: center !important; 
 
       display: block !important; 
 
       margin-left: auto !important; 
 
       margin-right: auto !important; 
 
       float: none !important; 
 
      } 
 
      table.center-on-narrow { 
 
       display: inline-block !important; 
 
      } 
 

 
      /* What it does: Adjust typography on small screens to improve readability */ 
 
\t \t \t .email-container p { 
 
\t \t \t \t font-size: 17px !important; 
 
\t \t \t \t line-height: 22px !important; 
 
\t \t \t } 
 

 
\t \t \t /* What it does: Adjusts reduces padding on discount boxes; */ 
 
\t \t \t .discount-outside { 
 
      \t padding: 10px !important; 
 
      } 
 
      .discount-td-first { 
 
      \t padding: 30px 10px 10px 10px !important; 
 
      } 
 
      .discount-td-middle { 
 
      \t padding: 10px 30px !important; 
 
      } 
 
      .discount-td-last { 
 
      \t padding: 10px 10px 30px 10px !important; 
 
      } 
 
     } 
 

 
    </style> 
 

 
    <!-- What it does: Makes background images in 72ppi Outlook render at correct size. --> 
 
    <!--[if gte mso 9]> 
 
\t <xml> 
 
\t \t <o:OfficeDocumentSettings> 
 
\t \t \t <o:AllowPNG/> 
 
\t \t \t <o:PixelsPerInch>96</o:PixelsPerInch> 
 
\t \t </o:OfficeDocumentSettings> 
 
\t </xml> 
 
    <![endif]--> 
 

 
</head> 
 
<body width="100%" bgcolor="#f6f6f6" style="margin: 0; mso-line-height-rule: exactly;"> 
 
    <center style="width: 100%; background: #f6f6f6; text-align: left;"> 
 

 
     <!-- Visually Hidden Preheader Text : BEGIN --> 
 
     <div style="display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide:all;font-family: sans-serif;"> 
 
      (Optional) This text will appear in the inbox preview, but not the email body. 
 
     </div> 
 
     <!-- Visually Hidden Preheader Text : END --> 
 

 
     <!-- 
 
      Set the email width. Defined in two places: 
 
      1. max-width for all clients except Desktop Windows Outlook, allowing the email to squish on narrow but never go wider than 680px. 
 
      2. MSO tags for Desktop Windows Outlook enforce a 680px width. 
 
      Note: The Fluid and Responsive templates have a different width (600px). The hybrid grid is more "fragile", and I've found that 680px is a good width. Change with caution. 
 
     --> 
 
     <div style="max-width: 680px; margin: auto;" class="email-container"> 
 
      <!--[if mso]> 
 
      <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="680" align="center"> 
 
      <tr> 
 
      <td> 
 
      <![endif]--> 
 

 
      <!-- Email Header : BEGIN --> 
 
      <table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 680px;"> 
 
       <tr> 
 
        <td style="padding: 20px 0; text-align: center"> 
 
         <img src="https://elementpaints.com/wp-content/uploads/2017/07/Element-db3236-transparent-200x42.png" width="200" height="42" alt="Element Paints - Enable images to view" border="0" style="height: auto; background: #f6f6f6; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #f6f6f6;"> 
 
        </td> 
 
       </tr> 
 
      </table> 
 
      <!-- Email Header : END --> 
 

 
      <!-- Email Body : BEGIN --> 
 
      <table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 680px; border-radius: 5px;" class="email-container" bgcolor="#ffffff"> 
 

 

 

 
       <!-- 1 Column Text : BEGIN --> 
 
       <tr> 
 
        <td bgcolor="#ffffff"> 
 
         <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"> 
 
          <tr> 
 
           <td style="padding: 40px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;"> 
 
            <p style="margin: 0 0 10px 0;">Maecenas sed ante pellentesque, posuere leo id, eleifend dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent laoreet malesuada cursus. Maecenas scelerisque congue eros eu posuere. Praesent in felis ut velit pretium lobortis rhoncus ut&nbsp;erat.</p> 
 
           </td> 
 
          </tr> 
 
         </table> 
 
        </td> 
 
       </tr> 
 
       <!-- 1 Column Text : END --> 
 

 

 

 

 

 
       <!-- 3 Even Columns : BEGIN --> 
 
       <tr> 
 
        <td bgcolor="#ffffff" align="center" height="100%" valign="top" width="100%" style="padding: 10px 0;"> 
 
         <!--[if mso]> 
 
         <table role="presentation" border="0" cellspacing="0" cellpadding="0" align="center" width="660"> 
 
         <tr> 
 
         <td align="center" valign="top" width="660"> 
 
         <![endif]--> 
 
         <table role="presentation" border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="max-width:660px;"> 
 
          <tr> 
 
           <td align="center" valign="top" style="font-size:0;"> 
 
            <!--[if mso]> 
 
            <table role="presentation" border="0" cellspacing="0" cellpadding="0" align="center" width="660"> 
 
            <tr> 
 
            <td align="left" valign="top" width="220"> 
 
            <![endif]--> 
 
            <div style="display:inline-block; margin: 0 -2px; max-width:33.33%; min-width:220px; vertical-align:top; width:100%;" class="stack-column"> 
 
             <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"> 
 
              <tr> 
 
               <td style="padding: 10px 10px;"> 
 
                <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: 14px;text-align: center;"> 
 
                 <tr> 
 
                  <td> 
 
                   <img src="https://elementpaints.com/wp-content/uploads/2017/02/Paint-brush-80x80.png" width="80" height="" border="0" alt="Soft Buttery Texture Image" class="center-on-narrow" style="width: 100%; max-width: 80px; height: auto; background: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #ffffff;"> 
 
                  </td> 
 
                 </tr> 
 
                 <tr> 
 
                  <td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding-top: 10px;" class="stack-column-center"> 
 
                  \t <h3>Soft Buttery Texture</h3> 
 
                   <p style="margin: 0 0 10px 0;">Feels great on the brush, always a pleasure to work with.</p> 
 
                  </td> 
 
                 </tr> 
 
                </table> 
 
               </td> 
 
              </tr> 
 
             </table> 
 
            </div> 
 
            <!--[if mso]> 
 
            </td> 
 
            <td align="left" valign="top" width="220"> 
 
            <![endif]--> 
 
            <div style="display:inline-block; margin: 0 -2px; max-width:33.33%; min-width:220px; vertical-align:top; width:100%;" class="stack-column"> 
 
             <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"> 
 
              <tr> 
 
               <td style="padding: 10px 10px;"> 
 
                <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: 14px; text-align: center;"> 
 
                 <tr> 
 
                  <td> 
 
                   <img src="https://elementpaints.com/wp-content/uploads/2017/02/Color-Plate-80x80.png" width="80" height="" border="0" alt="Heavy Pigment Load Image" class="center-on-narrow" style="width: 100%; max-width: 80px; height: auto; background: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #ffffff;"> 
 
                  </td> 
 
                 </tr> 
 
                 <tr> 
 
                  <td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding-top: 10px;" class="stack-column-center"> 
 
                  \t <h3>Heavy Pigment Loads</h3> 
 
                   <p style="margin: 0 0 10px 0;">Optimal pigment ratios give you rich vivid colors, and the best coverage.</p> 
 
                  </td> 
 
                 </tr> 
 
                </table> 
 
               </td> 
 
              </tr> 
 
             </table> 
 
            </div> 
 
            <!--[if mso]> 
 
            </td> 
 
            <td align="left" valign="top" width="220"> 
 
            <![endif]--> 
 
            <div style="display:inline-block; margin: 0 -2px; max-width:33.33%; min-width:220px; vertical-align:top; width:100%;" class="stack-column"> 
 
             <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"> 
 
              <tr> 
 
               <td style="padding: 10px 10px;"> 
 
                <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: 14px; text-align: center;"> 
 
                 <tr> 
 
                  <td> 
 
                   <img src="https://elementpaints.com/wp-content/uploads/2017/02/Picture-icon-80x81.png" width="80" height="" border="0" alt="alt_text" class="center-on-narrow" style="width: 100%; max-width: 80px; height: auto; background: #ffffff; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #ffffff;"> 
 
                  </td> 
 
                 </tr> 
 
                 <tr> 
 
                  <td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding-top: 10px;" class="stack-column-center"> 
 
                  \t <h3>Lightfast Colors</h3> 
 
                   <p style="margin: 0 0 10px 0;">Strong permanent colors stop your painting from fading over time.</p> 
 
                  </td> 
 
                 </tr> 
 
                </table> 
 
               </td> 
 
              </tr> 
 
             </table> 
 
            </div> 
 
            <!--[if mso]> 
 
            </td> 
 
            </tr> 
 
            </table> 
 
            <![endif]--> 
 
           </td> 
 
          </tr> 
 
         </table> 
 
         <!--[if mso]> 
 
         </td> 
 
         </tr> 
 
         </table> 
 
         <![endif]--> 
 
        </td> 
 
       </tr> 
 
       <!-- 3 Even Columns : END --> 
 

 

 

 
       <!-- DISCOUNT 1 COLUMN : BEGIN --> 
 
       <tr> 
 
        <td bgcolor="#ffffff" class="discount-outside" style="padding: 10px 40px;"> 
 
         <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="border: 8px dashed #cccccc; text-align: center;"> 
 
          <tr> 
 
           <td class="discount-td-first" style="padding: 30px 30px 10px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;"> 
 
            <h1>heading</h1> 
 
           </td> 
 
          </tr> 
 
          <tr> 
 
           <td class="discount-td-middle" style="padding: 0 30px 10px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;"> 
 
            <p style="margin: 0 0 10px 0;">text:</p> 
 
           </td> 
 
          </tr> 
 
          <tr> 
 
           <td class="discount-td-middle" style="padding: 0 30px 10px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;"> 
 
            <h2>XXX-CODE-GOES-HERE-XXX</h2> 
 
           </td> 
 
          </tr> 
 
          <tr> 
 
           <td class="discount-td-last" style="padding: 0 30px 30px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;"> 
 
\t \t \t \t \t \t \t \t \t <!-- Button : BEGIN --> 
 
\t \t \t \t \t     <table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" style="margin: auto;"> 
 
\t \t \t \t \t      <tr> 
 
\t \t \t \t \t       <td style="border-radius: 3px; background: #222222; text-align: center;" class="button-td"> 
 
\t \t \t \t \t        <a href="http://www.google.com" style="background: #222222; border: 15px solid #222222; font-family: sans-serif; font-size: 13px; line-height: 1.1; text-align: center; text-decoration: none; display: block; border-radius: 3px; font-weight: bold;" class="button-a"> 
 
\t \t \t \t \t         <span style="color:#ffffff;" class="button-link">&nbsp;&nbsp;&nbsp;&nbsp;A Button&nbsp;&nbsp;&nbsp;&nbsp;</span> 
 
\t \t \t \t \t        </a> 
 
\t \t \t \t \t       </td> 
 
\t \t \t \t \t      </tr> 
 
\t \t \t \t \t     </table> 
 
\t \t \t \t \t     <!-- Button : END --> 
 
           </td> 
 
          </tr>               
 
         </table> 
 
        </td> 
 
       </tr> 
 
       <!-- DUSCOUNT 1 COLUMN : END --> 
 

 

 

 
       <!-- Clear Spacer : BEGIN --> 
 
       <tr> 
 
\t \t \t \t \t <td aria-hidden="true" height="30" style="font-size: 0; line-height: 0;"> 
 
         &nbsp; 
 
        </td> 
 
       </tr> 
 
       <!-- Clear Spacer : END --> 
 

 
      </table> 
 
      <!-- Email Body : END --> 
 

 
      <!-- Email Footer : BEGIN --> 
 
      <table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 680px;"> 
 
       <tr> 
 
        <td style="padding: 40px 10px 10px; width: 100%; font-size: 12px; font-family: sans-serif; line-height:18px; text-align: center; color: #cccccc;" class="x-gmail-data-detectors"> 
 
\t \t \t \t \t <a href="%WEBCOPY%" style="color:#cccccc; text-decoration:underline; font-weight: bold;">View as a Web Page</a> 
 
        <br><br> 
 
        %SENDER-INFO-SINGLELINE% 
 
        <br> 
 
\t \t \t \t \t <a href="%UNSUBSCRIBELINK%" style="color:#cccccc; text-decoration:underline;">unsubscribe</a> 
 
        </td> 
 
       </tr> 
 
      </table> 
 
      <!-- Email Footer : END --> 
 

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

 
    </center> 
 
</body> 
 
</html>

+0

是否將此表格封裝到帶有'border-radius'的div中? –

+0

@VadimOvchinnikov divs在電子郵件unfortunatley中不能很好地工作,所以我必須避免這種情況。 – bennygill

+0

您是否嘗試編寫'內聯CSS'? –

回答

0

添加樣式= 「背景:無」 到你的福斯特在 「1個文本」 一節。這應該做你想做的。

<!-- 1 Column Text : BEGIN --> 
    <tr> 
     <td bgcolor="#ffffff" style="background:none"> 
      <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"> 
       <tr> 
        <td style="padding: 40px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;"> 
        <p style="margin: 0 0 10px 0;">Maecenas sed ante pellentesque, posuere leo id, eleifend dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent laoreet malesuada cursus. Maecenas scelerisque congue eros eu posuere. Praesent in felis ut velit pretium lobortis rhoncus ut&nbsp;erat.</p> 
        </td> 
       </tr> 
      </table> 
     </td> 
    </tr> 
<!-- 1 Column Text : END -->