3

我是新手HTML,我在 Google 上搜索,发现了一些代码片段。我正在尝试在 Outlook 电子邮件正文中放置一个表格:

HTML

<html>
     <body>
         <table style="
         margin: 10px" 
         bordercolor="black"
         cellspacing="0"
         cellpadding="2"
         width="300"
         border="1">
             <!--Content here -->
         </table>
     </body>
 </html> 

好吧,它工作正常,但我的要求已经改变,我想要以下内容:

  • 指定表width (7.5寸)
  • 我想指定Calibri字体
  • 我希望font-size11
4

2 回答 2

4

您好,欢迎来到古怪的 html 电子邮件世界。

Calibri 不是一种通用字体,因此声明它不会显示在所有没有本机的设备/操作系统上。您必须像我在下面的示例中所做的那样设置后备。

边距也有有限的支持,并被 Outlook 2013 完全忽略,因此请避免使用填充或空表

以英寸为单位声明也不起作用,因此您必须在打印时测试什么像素大小对您有效/相等。

这是一个基本的表格:

<table width="600" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td border="1" style="padding:10px; font-family: 'Calibri', Helvetica, Arial, sans-serif; font-size: 11px; color: #000000;">
      Your content here
    </td>
  </tr>
</table>
于 2013-06-20T19:27:23.543 回答
1

HTML emails are a very strange beast indeed. I spend a lot of my time each week writing them. Some advice: A table width of 656 works pretty well, and I wouldn't go a whole lot larger. I know that width prints on standard 8.5" x 11" paper well enough. We use it in all of our HTML emails and it usually renders well everywhere. We test on gmail, Outlook 2007, and the default mail application for OSX.

As @John mentioned Calibri is a Microsoft font, so it will only come through on machines that have it installed. Which should work out for you okay, as long as you also have a websafe back up available.

<table width="656" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td style="font-family: 'Calibri', Arial, sans-serif ;font-size: 11px;">Some content</td>
    </tr>
</table>

Another HTML email pointer. If you add any <a> and would like for them to not be the standard blue color, make sure you assign a style="color: #(color hex);" for each one.

Best of luck. Writing HTML emails can be really frustrating some days.

于 2013-06-20T19:45:15.853 回答