Document.alinkColor is a deprecated instance property that gets or sets the color of an active link—the brief state between mousedown and mouseup. Learn what it controls, how it relates to legacy linkColor / vlinkColor, the modern :active CSS replacement, and five examples with try-it labs.
01
Kind
Instance property
02
Type
string color
03
Status
Deprecated
04
Means
Active link
05
Replace
CSS :active
06
Legacy set
link / vlink
Fundamentals
Introduction
Early HTML pages often set global link colors with JavaScript or the obsolete <body alink="..."> attribute. The Document object exposed matching properties: linkColor (unvisited), vlinkColor (visited), and alinkColor (active while pressed).
An active link is not a “currently focused” link—it is the moment the user holds the mouse button down on a hyperlink, between mousedown and mouseup.
💡
Learn it, don’t ship it
Study alinkColor 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 active-link color string; writing it changes the color applied to active links in the document body.
Value — a color name (blue, darkorange) or hex (#0066CC).
Active state — between mousedown and mouseup on a link.
null — assigning null converts to "" (empty string).
Firefox default — MDN: red (#ee0000) in Mozilla Firefox.
Deprecated — MDN recommends CSS :active instead.
Foundation
📝 Syntax
JavaScript
document.alinkColor
Get
JavaScript
console.log(document.alinkColor);
// e.g. "#ee0000" in Firefox (browser-dependent)
Document.alinkColor is deprecated but may still exist for compatibility in some browsers. MDN recommends CSS :active instead. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Deprecated · Legacy
Document.alinkColor
Legacy active-link color getter/setter — use CSS :active in new code.
LegacyCompatibility only
Mozilla FirefoxSupported · default #ee0000 (MDN)
Legacy support
Google ChromeMay expose property · prefer CSS
Legacy / limited
Apple SafariDo not rely on alinkColor
Legacy / limited
Microsoft EdgeChromium · prefer CSS :active
Legacy / limited
OperaFollow Chromium behavior
Legacy / limited
Internet ExplorerLegacy Document color APIs
Legacy support
Document.alinkColorAvoid in new code
Bottom line: Recognize alinkColor in old scripts. For new styling, use a:link, a:visited, a:hover, and a:active in CSS — never document.alinkColor.
Wrap Up
Conclusion
Document.alinkColor is a deprecated way to control the color of links while the mouse button is held down. 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 alinkColor 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.alinkColor in new production code
Confuse active (mouse down) with focus or hover
Assume the same default color in every browser
Mix deprecated Document colors with design-system CSS blindly
Depend on alinkColor for accessibility contrast
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about alinkColor
Deprecated active-link color — prefer CSS :active.
5
Core concepts
📝01
Type
string color
API
⚠️02
Status
deprecated
Legacy
🖱03
When
mousedown
State
✓04
Replace
a:active
CSS
🔄05
null
becomes ""
Quirk
❓ Frequently Asked Questions
It gets or sets the color of an active link in the document body. A link is active between mousedown and mouseup — while the user is pressing the mouse button on it.
Yes. MDN marks Document.alinkColor as deprecated. It may still work in some browsers for compatibility, but you should use CSS :active (or :focus where appropriate) in new code.
A string color name (such as blue or darkorange) or a hexadecimal color (such as #0066CC). Setting null is converted to the empty string.
MDN notes the default alinkColor in Mozilla Firefox is red (#ee0000 in hexadecimal).
Legacy Document properties include linkColor (unvisited), vlinkColor (visited), and alinkColor (active/pressed). Modern CSS uses :link, :visited, and :active pseudo-classes instead.
No. Style links with CSS — for example a:active { color: ... } — or component styles. Learn alinkColor 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.