Set font weight and color for active anchor in HTML and CSS

Description

The following code shows how to set font weight and color for active anchor.

Example


<html>
<head>
<style>
a:active { font-weight:bold; color:red }
</style><!--   w  w w  . j a  va 2 s .co  m-->
</head>
<body>
<p>Press tab key to bring the link into focus.</p>
<a href="http://www.java2s.com" target="_blank">java2s.com Home Page link</a>
</body>
</html>

Click to view the demo

The code above generates the following result.

Set font weight and color for active anchor in HTML and CSS