HTML vlink Attribute
The obsolete HTML vlink attribute was historically used on the <body> element to specify the color of hyperlinks that a visitor had already visited.
vlink attribute is obsolete and should not be used in modern HTML. Use the CSS :visited pseudo-class to style visited links.
Historical Syntax
The vlink attribute was placed on the <body> element and used a color value to specify the appearance of visited hyperlinks throughout the document.
<body vlink="purple">
Older documents could also use hexadecimal color values.
<body vlink="#800080">
Historical Elements
The obsolete vlink attribute was associated with the <body> element.
| Element | Historical Purpose |
|---|---|
<body> |
Specified the color used for visited hyperlinks in the document. |
Historical Use
The vlink attribute allowed authors to choose a document-wide color for links that a visitor had previously followed.
<body link="blue" vlink="purple" alink="red">
<p><a href="flowers.html">Flowers</a></p>
<p><a href="vegetables.html">Vegetables</a></p>
</body>
It was commonly used with the obsolete link attribute for unvisited links and the obsolete alink attribute for active links.
Why It Became Obsolete
The vlink attribute controlled presentation directly in HTML markup. CSS provides a more flexible way to style different hyperlink states while keeping presentation separate from document structure.
With CSS, link colors can be defined in one stylesheet and applied consistently across an entire website without adding presentational attributes to individual HTML documents.
Modern Alternative
Use the CSS :visited pseudo-class instead of the obsolete vlink attribute.
Historical HTML
<body vlink="purple">
Modern CSS
a:visited {
color: purple;
}
The :visited pseudo-class selects links whose destinations have been visited according to the browser's history.
CSS can also style the other common hyperlink states:
a:link {
color: blue;
}
a:visited {
color: purple;
}
a:hover {
color: green;
}
a:active {
color: red;
}
When styling multiple link states, keep the rules in a useful order so later rules do not unintentionally override earlier states.
Play in EditorLearn More About CSS Links
The CSS tutorials explain how to style hyperlinks and their different states:
- CSS Styling Links - Style normal, visited, hover, and active links.
- CSS Pseudo-classes - Learn how pseudo-classes such as
:visited,:hover, and:activeselect elements based on their state. - CSS Font Color - Control the foreground color of text and links.
Legacy Browser Support
The vlink attribute was widely recognized by older browsers as a way to specify the document's visited-link color.
Browsers may continue to recognize the attribute when rendering legacy documents, but it is obsolete and should not be used in new or updated HTML. Use the CSS :visited pseudo-class instead.
For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.
Related Attributes
Other obsolete attributes historically used to control document and hyperlink colors include:
Specifications
The vlink attribute on the <body> element is obsolete and should not be used in modern HTML. CSS pseudo-classes should be used to control the appearance of different hyperlink states. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.
