Home  >  Article  >  Web Front-end  >  What to do if visited css doesn’t work

What to do if visited css doesn’t work

藏色散人
藏色散人Original
2020-12-14 09:25:063033browse

Visited css does not work solution: 1. Correct the order of the four states of the hyperlink defined in css; 2. Modify the style to "a:visited {color: #FFFF00;text-decoration:none;} "That's it.

What to do if visited css doesn’t work

The operating environment of this tutorial: windows7 system, css3 version, thinkpad t480 computer.

Why does:visited not work in css?

1. The order may be different

css definition of the four states of hyperlinks is also in order

a:link {} /* 未访问的链接 */
a:visited {} /* 已访问的链接 */
a:hover {} /* 当有鼠标悬停在链接上 */
a:active {} /* 被选择的链接 */

There is a little need for the settings of these four pseudo-classes Pay special attention to their order, and make them follow a sequence principle, that is, link ~ visited ~ hover ~ active. If you get the order wrong, unexpected errors will occur. If you are a beginner, you can practice it in private.

2. It is possible that the link in a href is invalid.

The invalid link will invalidate the visited setting of a. This is because there is no history of web page visits after clicking the link, so the link is invalid after clicking.

***If the code is as follows, that is, a href="#" link is consistent, it will cause all visited to change color after clicking

  a:visited   {color: #FFFF00;  text-decoration:none;}

AA

BB

Recommendation: "css video tutorial

The above is the detailed content of What to do if visited css doesn’t work. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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