简体   繁体   中英

Background image not displaying for email in html

I am creating a template for email contains a background. It is visible in browser not in mail.

<tr>
  <td  colspan="2">
     <table style="width:195px;background: url(coupon_bg%20.png);background-repeat: no-repeat;">
        <tr>
           <td style="border-right: white 1px solid;padding-bottom: 5px; "><span style="font-size: 20px;" ><b>40%</b></span><br />discount</td>
           <td style="padding-left: 10px;"> code <br>XXXXX</td>
        </tr>
       </table>
     </td>
  <td style="padding-left: 10px;font-size: 12px;font-weight: bold;line-height: 15px;">Our new update would give parents an opportunity to learn a lot more about their children's performance at school.</td>
</tr>

width of outer tr 545px,table with 195px, actual image width 190px, last td width 348px

Since the email is received out from the domain of your site, url(coupon_bg%20.png) returns an incomplete path. It should point to a fully qualified path, eg: http://foo.org/path/to/image .

EDIT

Also beware of space characters in file names. coupon_bg%20.png means that the source file name must be "coupon_bg .png" (notice the space character before the dot).

When you are checking your code in your browser your image path is correct. But when you will send the code in email image path will be different. So put full image path in code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM