The way to set the hyperlink style in css is to add a pseudo-class to the hyperlink, such as [a:visited {color:#00FF00;}]. [a:visited] indicates links that the user has visited.
The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.
If we want to set the style of a hyperlink, we can actually use any css attribute, such as color, font, background, etc. But if you want to set a special style, you need to use pseudo classes. Let's take a look at pseudo-classes together.
Tip: Special links can have different styles, depending on their status.
The four link statuses are:
a:link - normal, unvisited link
a: visited - the link that the user has visited
a:hover - when the user mouses over the link
a:active - the link is The moment you click
Code example:
php中文网(php.cn) 注意: a:hover 必须在 a:link 和 a:visited 之后,需要严格按顺序才能看到效果。
注意: a:active 必须在 a:hover 之后。
Let’s take a look at the running effect:
Related recommendations:css video tutorial
The above is the detailed content of How to set hyperlink style with css. For more information, please follow other related articles on the PHP Chinese website!