Search code examples
c#htmlstylescode-behind

Add Style attribute to HTML tags from code behind using C#


enter image description here

Hi all,

I want to add style attributes in my HTML tags using C#. Please find the below code.

            StringBuilder mailBody = new StringBuilder();
            mailBody.AppendFormat("<html>");
            mailBody.AppendFormat("<p>Please note:</p>");
            mailBody.AppendFormat("<p> " + data + " folder no longer exists on the network. Please review at your earliest convenience. </p>");
            mailBody.AppendFormat("<br/>");
            mailBody.AppendFormat("<p>Thank you</p>");
            mailBody.AppendFormat("<p>Development Team</p>");
            mailBody.AppendFormat("</html>");
            emailBody = mailBody.ToString();

And the output is :

The text displayed in the image font style is "Time New Roman". How could I change that to display in any other font type. How could I add that in above HTML tags.

Thanks in advance.


Solution

  • <p><span style="font-family:Verdana">Please note:</span></p>
    

    http://www.w3schools.com/html/html_styles.asp