Links can be styled in numerous ways in CSS. Links are styled differently based on the state the links are in. Those states are:
- a:link
- a:visited
- a:hover
- a:active
Syntax:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
/* unvisited link */
a:link {
color: red;
}
/* visited link */
a:visited {
color: green;
}
/* mouse over link */
a:hover {
color: hotpink;
}
/* selected link */
a:active {
color: blue;
}
</style>
</head>
<body>
<div>
<a href="https://www.greatlearning.in" target="_blank">Great Learning</a>
</div>
</body>
</html>
Output: