【问题标题】:how to set font in html for iphone application如何在 html 中为 iPhone 应用程序设置字体
【发布时间】:2013-05-30 09:04:08
【问题描述】:

我在 html 中设置字体,但它不起作用。这是我的代码。

    NSString * emailBody =@"<html><body>Thank you for your participation in
    Consulting<br>Practitioner and Client Program.</br>
    <br>Attached is the copy of your signed contract for your records
    <p>Please email or fax your completed W-9 form to
    <br>our PEI Support Team
    <br>Email:PEISupportServices@zoetis.com
    <br>Fax:800-741-1310
    <p><b><u><font color:'#888888'>IMPORTANT: Please provide invoice for this 
    consultation to your Zoetis Representative to ensure payment.  
    Do NOT mail directly to Zoetis.</u></b>
    <p>Billing Address:<br>Zoetis<br>100 Campus Drive<br>Florham Park, NJ  07932
    <body></html>";

【问题讨论】:

    标签: html iphone fonts


    【解决方案1】:

    因为您的 HTML 无效。专门针对您需要的字体

    <font color="#888888">
    

    您将 CSS 语法与 HTML 语法混合在一起。您在任何地方也没有关闭 &lt;/font&gt; 标记。

    你的body标签也在最后打开。你需要&lt;/body&gt;

    【讨论】:

      【解决方案2】:

      我用了以下方式,字体名称和颜色

           - (NSString *)messageBody
           {
      
      
                   NSMutableString *emailBody = [NSMutableString stringWithFormat:@"<div> \n"
                                        "<p style=\"font:17px Helvetica,Arial,sans-serif\">%@</p> \n"
                                        "<h1 style=\"font:bold 16px Helvetica,Arial,sans-serif\"><a target=\"_blank\" href=\"%@\">%@</a></h1> \n"
                                        "<br> \n"
                                        "<table align=\"center\"> \n"
                                        "<tbody> \n"
                                        "<tr> \n"
                                        "<td valign=\"top\" align=\"center\"> \n"
                                        "<span style=\"font-family:Helvetica,Arial;font-size:11px;color:#696969;font-weight:bold\"> \n"
                                        "</td> \n"
                                        "</tr> \n"
                                        "<tr> \n"
                                        "<td align=\"left\"> \n"
                                        "<span style=\"font-family:Helvetica,Arial;font-size:11px;color:#696969\"> \n"
                                        "Please note that you have not been added to any email lists. \n"
                                        "</span> \n"
                                        "</td> \n"
                                        "</tr> \n"
                                        "</tbody> \n"
                                        "</table> \n"
                                        "</div>",
                                        self.message,
                                        [self.appStoreURL absoluteString],
                                        self.applicationName
                                        ];
      
                   return emailBody;
      
               }
      

      【讨论】:

        猜你喜欢
        • 2020-02-15
        • 2011-01-12
        • 2011-03-09
        • 2018-03-24
        • 1970-01-01
        • 1970-01-01
        • 2014-07-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多