HTML colors

Colors are very important to give a good look and feel to your website. You can specify colors on page level using <body> tag or you can set colors for individual tags.

The color attribute specifies the color of the text inside a <font> element.

For example:

Try it

<html>
<head>
<title>This is title</title>
</head>
<body>
<font color="red">Old lorem text</font>
<font color="Blue">new lorem text</font>
</body>
</html>

The <body> tag has following attributes which can be used to set different colors:

  • bgcolor: Sets a color for the background of the page.
  • text: Sets a color for the body text.
  • alink: Sets a color for active links or selected links.
  • link: Sets a color for linked text.
  • vlink: Sets a color for visited links – that is, for linked text that you have already clicked on.

NOTE: It is recommended to use CSS to set background or text colors.