如何更改字符串的字体样式?

时间:2014-04-04 15:34:27

标签: c# html

我有一个字符串,我发送到电子邮件服务器作为电子邮件的正文。我正试图控制它最终会在电子邮件中出现的字体。这是字符串:

@"Dear " + txtName.Text + ",<br/><br/>Thank you for submitting. <br/><br/>In the event of any changes, please submit again here" + link + ". <br><br>The following is a summary for your records.<br/><br/>"

如何制作字体,比如Times New Roman?

似乎有关字体更改的所有信息总是涉及使用ASP控件,但在这种情况下这不符合图片。

1 个答案:

答案 0 :(得分:0)

要更改font-family,您必须使用 CSS

string mail = @"Dear " + txtName.Text + ",<br/><br/>Thank you for submitting. <br/><br/>In the event of any changes, please submit again here" + link + ". <br><br>The following is a summary for your records.<br/><br/>"

例如Time New Roman

mail = "<p><span style=\"font-family: Time New Roman;\">" + mail + </span></p>"

如果客户端没有第一个字体,您应该知道可以使用不同的字体:

font-family: Times, "Times New Roman", Georgia, serif;

如果您需要有关邮件格式的更多提示: