Body link attribute
Body object
Definition and Usage
The link attribute sets or returns the value of the link attribute of the body element.
The link attribute specifies the color of links in the document that have not been clicked or visited.
Syntax
Set the link attribute:
bodyObject.link="
color
"
Return the link attribute:
bodyObject.link
| Value | Description |
|---|---|
| color | Specifies the link color. See the complete A CSS color value |
Browser support





All major browsers support the link attribute
Example
Example
Return the color of links in the document that are unclicked, clicked, and after being visited:
<p>
<a href="//www.runoobb.com">Runoob Tutorial
a
p
<p>
<a href="//www.runoobb.com/html/">HTML Tutorial
a
p
<
script
document.write("color of unclicked link is: ") document.write(document.getElementById("runoob").link); document.write("
<
br
selected link color is: ") document.write(document.getElementById("runoob").aLink); document.write("
<
br
visited link color is: ") document.write(document.getElementById("runoob").vLink);
script
Try it »
Body object