Advertisement

Google Ad Slot: content-top

CSS Link


In CSS, you can style hyperlinks (links) using pseudo-classes that represent different states of the links. The most commonly used pseudo-classes for links are:


:link: Targets an unvisited link.

:visited: Targets a link that has already been visited.

:hover: Targets a link when the user hovers over it with the mouse.

:active: Targets a link at the moment it is being clicked.

Example
/* Unvisited link */
a:link {
color: blue;
text-decoration: none;
}

/* Visited link */
a:visited {
color: purple;
}

/* When the user hovers over the link */
a:hover {
color: red;
text-decoration: underline;
}

/* When the link is being clicked */
a:active {
color: orange;
}
Try it yourself