CSS Attributes Index Pseudo-class Attributes
Sets or retrieves the style of unvisited hypertext links ( anchor elements ) in a document.
CSS |
[ A ] :link { attribute1:parameter1 [ ; attribute2:parameter2 [ ; . . . ] ] } |
Script |
N/A |
attribute |
Any attribute applicable to text. |
parameter |
Any of the range of values available to the corresponding attribute. |
This pseudo-class is read/write with a default value that is browser-specific.
Unvisited means that the user has not previously navigated the link. Setting the link pseudo-class is often used in conjunction with the following pseudo-elements to define the various states of a link: active, visited, and hover.
Using pseudo-classes on elements other than the A element has no effect.
The following demonstrates use of the a:link attribute in an embedded stylesheet to set the color of unvisited hyperlinks on a page.
<style type="text/css">
a:link {
font-weight: bold; color: #8be }
a:visited {
color: #eb8 }
a:active {
background-color: #eec; color: #500 }
a:hover {
color: #bc7; text-decoration: none;
font-variant: small-caps }
-->
</style>
This feature requires Microsoft® Internet Explorer® 4.0 or later.
Show me
The CSS :link attribute can also be used for contextual hyperlinks, or links which are contained within other selectors. For instance:
ul a:link, ul a:visited, ul a:active {
font: bold 11pt Arial; color: #9cf;
text-decoration: none }
.showme a:link, .showme a:visited, .showme a:active {
font: bold 11pt arial; background: navy; color: lime;
text-decoration: none; padding: 3 }
That declaration will apply the style to all links within an unordered list ( UL ) element, as well as to elements whose class attribute is set to showme.
A
active, hover, visited