Document.linkColor is a deprecated instance property that gets or sets the color of unvisited links in the document. Learn what it controls, how it fits with legacy vlinkColor and alinkColor, the modern :link CSS replacement, and five examples with try-it labs.
01
Kind
Instance property
02
Type
string color
03
Status
Deprecated
04
Means
Unvisited link
05
Replace
CSS :link
06
Legacy set
vlink / alink
Fundamentals
Introduction
Early HTML pages often set global link colors with JavaScript or the obsolete <body link="..."> attribute. The Document object exposed matching properties: linkColor (unvisited), vlinkColor (visited), and alinkColor (active while pressed).
An unvisited link is a normal hyperlink the browser has not yet marked as visited. Once the user opens the URL, the link moves to the visited state and vlinkColor (or CSS :visited) applies instead.
💡
Learn it, don’t ship it
Study linkColor so you can recognize legacy scripts and old tutorials. For new pages, style links with CSS pseudo-classes: :link, :visited, :hover, and :active.
A getter/setter instance property on Document. Reading it returns the unvisited-link color string; writing it changes the color applied to unvisited links in the document body.
Value — a color name (blue, darkgreen) or hex (#0066CC).
Unvisited state — links the user has not opened yet in this session.
null — assigning null converts to "" (empty string).
Firefox default — MDN: blue (#0000ee) in Mozilla Firefox.
Deprecated — MDN recommends CSS :link or color on <a> instead.
Foundation
📝 Syntax
JavaScript
document.linkColor
Get
JavaScript
console.log(document.linkColor);
// e.g. "#0000ee" in Firefox (browser-dependent)
Document.linkColor is deprecated but may still exist for compatibility in some browsers. MDN recommends CSS :link instead. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Deprecated · Legacy
Document.linkColor
Legacy unvisited-link color getter/setter — use CSS :link in new code.
LegacyCompatibility only
Mozilla FirefoxSupported · default #0000ee (MDN)
Legacy support
Google ChromeMay expose property · prefer CSS
Legacy / limited
Apple SafariDo not rely on linkColor
Legacy / limited
Microsoft EdgeChromium · prefer CSS :link
Legacy / limited
OperaFollow Chromium behavior
Legacy / limited
Internet ExplorerLegacy Document color APIs
Legacy support
Document.linkColorAvoid in new code
Bottom line: Recognize linkColor in old scripts. For new styling, use a:link, a:visited, a:hover, and a:active in CSS — never document.linkColor.
Wrap Up
Conclusion
Document.linkColor is a deprecated way to control the color of unvisited links in a document. It is useful for understanding legacy pages and migrating them to CSS—not for new features.
Style links with CSS :link, :visited, :hover, :active
Add visible :focus styles for keyboard users
Replace linkColor when updating legacy files
Learn legacy Document color properties to read old code
Test link states in real browsers after migrating to CSS
❌ Don’t
Set document.linkColor in new production code
Confuse unvisited with visited or active states
Assume the same default color in every browser
Mix deprecated Document colors with design-system CSS blindly
Depend on linkColor for accessibility contrast
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about linkColor
Deprecated unvisited-link color — prefer CSS :link.
5
Core concepts
📝01
Type
string color
API
⚠️02
Status
deprecated
Legacy
🔗03
When
unvisited
State
✓04
Replace
a:link
CSS
🔄05
null
becomes ""
Quirk
❓ Frequently Asked Questions
It gets or sets the color of unvisited links in the document. Unvisited links are hyperlinks the user has not opened yet in the current browsing session.
Yes. MDN marks Document.linkColor as deprecated. It may still exist for compatibility in some browsers, but you should use CSS :link or a { color: ... } in new code.
A string color name (such as blue or darkgreen) or a hexadecimal color (such as #0066CC). Setting null is converted to the empty string per MDN.
MDN notes the default linkColor in Mozilla Firefox is blue (#0000ee in hexadecimal).
linkColor styles unvisited links. vlinkColor styles visited links. alinkColor styles active links while the mouse button is held down. Modern CSS uses :link, :visited, and :active instead.
No. Style links with CSS pseudo-classes — for example a:link { color: ... } — or component styles. Learn linkColor only to read or migrate old scripts.
Did you know?
Old HTML used <body link="" vlink="" alink=""> attributes for the same three link colors. JavaScript document.linkColor, vlinkColor, and alinkColor mirrored those attributes—all superseded today by CSS pseudo-classes.