Hyperlinks
There are many ways in which CSS can be used to format and style HTML hyperlinks. Below are several examples.
Example: Specifying hyperlink colors
The CSS below specifies the color of an: a) unclicked hyperlink, b) visited hyperlink, d) hyperlink being hovered over by the mouse, and d) a hyperlink while it being clicked in.
a:link {
color: blue;
}
a:visited {
color: green;
}
a:hover {
color: fuchsia;
}
a:active {
color: lime;
}
Example: Specifying hyperlink font size, background color and border color
The CSS demonstrates an example of the unusual things that can be done with CSS. The font size, background color and border color of the hyperlink will change when the user hovers over the hyperlinks.
a:link {
color: blue;
}
a:visited {
color: green;
}
a:hover {
color: fuchsia;
font-size: 16pt;
background-color: yellow;
border: solid;
border-color: red;
}
a:active {
color: lime;
}
Output: