CSS and HTML 5 – Format Hyperlinks

You can format hyperlinks based on whether you’re hovering over them, actively clicking on them, or have visited them. This can be useful when creating dashboards and control panels.

linkStyle.css

a:link {
	color: blue;
}

a:hover {
	background-color: yellow;
}

a:active {
	background-color: red;
}

a:visited {
	color: grey;
}

link.html

<html>
<head>
<link rel="stylesheet" href="linkStyle.css" />
</head>
<body>

<h1> This is a <a href="link.html">LINK</a> example</h1>
<h1> This is a <a href="http://www.cnn.com">LINK</a> example</h1>

</body>
</html>

Be the first to comment

Leave a Reply