You can use the a element to create a link that will take you to another page.
Have you ever seen this link change color before and after a visit?
You can use the link pseudo-class to style unvisited links .
This time, I will introduce the a element and the CSS pseudo-class link.
Table of contents
- About pseudo-class link
- Summary: Master the pseudo-class link
About pseudo-class link
First, I will show you how to style the a element.
<a href="#">
a {
color: red;
}
The characters enclosed by the a tag turn red. It’s a basic designation.
Adding the pseudo-class link allows you to style unvisited links .
a:link{
color: green;
}
This specification is overridden by the other pseudo-classes “:visited”, “:hover” and “:active”.
- visited: visited link
- hover: the state where the mouse cursor is over
- active: between clicking and releasing an element
If you want to specify all of them, you should list them in the order link, visited, hover, active.
If you change the order, it will not work, so be careful.
Summary: Master the pseudo-class link
This time, I explained that you can change the style of unvisited links by specifying the pseudo-class link for the a element.
You mentioned that the order in which pseudo-classes are written is sometimes important.
I hope that this article will be of help to you.