HTML CSS IMAGES LINKS
 
HTML → Text and link colors

All attributes discussed on this page have been deprecated. A deprecated element or attribute is one that has been outdated by newer constructs. In general, authors should use style sheets to achieve stylistic and formatting effects rather than HTML presentational attributes. HTML presentational attributes have been deprecated when style sheet alternatives exist. Almost all attributes that specify the presentation of an HTML document (e.g., colors, alignment, fonts, graphics, etc.) have been deprecated in favor of style sheets.

Changing the Default Text Color
We said that every HTML page has a <body> tag. On both the Mac and PC, the default text color is black. We can change this color with the text attribute. In the example below, we are making the default text color red.

<body text="#ff0000">

The only way to experience this is to copy the code below, save it, then load it in a browser.

<html>
<head>
<title>Testing Changing the Default Text Color</title>
</head>
<body text="#ff0000">
This text should be all in red as we have changed the default text color.
</body>
</html>


Note: When specifying a hexidecimal color value, the code for the color will always follow the number sign (#).

Link Colors
A link or hyperlink is what you click on to get to another web page. A clue that text is actually a link is that it is underlined. For an image, the clue that it is a link appears when you place your cursor over the image. When the image is linked, the cursor changes from an icon of a pointer to an icon of a hand.

There are three types of links:
  • link (default color is blue);
  • vlink (default color is purple, stands for visited link, indicates past visit to the link);
  • alink (default color is red, stands for active link. When users press down on a link and hold the mouse button down, they will see the active link color. Most people click quickly and don't pay much attention to the alink color.)

Changing a Link Color
We can change a link color (the non-visited links on your page) with the link attribute. In the example below, we are making the link color green.

    <body link="#00ff00">

We can change a vlink color (visited links on your page) with the vlink attribute. In the example below, we are making the vlink color yellow.

<body vlink="#ffff00">

If you like, you can change both the link and the vlink colors.

<body link="#00ff00" vlink="#ffff00">

The order in which you list your attributes does not matter. However, it is suggested that you be consistent throughout your web site.

<body vlink="#ffff00" link="#00ff00">

We can change an alink color (active link) with the alink attribute. In the example below, we are making the alink color black. Most designers do not change this color unless the background color of their page happens to be red.

<body alink="#000000">

Remember: Every HTML document will have only one pair of body tags – the opening and closing tags. Like other tags, the body tag can contain multiple attributes. Therefore, your body tag may contain all three link color attributes, as well as other attributes already mentioned, such as margin size, text color, background color and more.

<body link="#00ff00" alink="#000000" vlink="#ffff00" text="#000000">

 
  back ↑