Computer >> Computer tutorials >  >> Programming >> HTML

How to set font color in HTML?


To set the font color in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property color. HTML5 do not support the <font> tag, so the CSS style is used to add font color. The <font> tag deprecated in HTML5.

Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.

How to set font color in HTML?

Example

You can try to run the following code to set font color in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Font color</title>
   </head>
   <body>
      <h1>Products</h1>
      <p style="color:blue">This is demo content.</p>
   </body>
</html>