How to set hyperlink style with css

王林
Release: 2021-06-21 09:16:16
Original
5821 people have browsed it

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.

How to set hyperlink style with css

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 之后。

Copy after login

Let’s take a look at the running effect:

How to set hyperlink style with css

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!