Home >Web Front-end >CSS Tutorial >What to do if visited css doesn't work
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.
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;} <p><a href="#">AA</a></p> <p><a href="#">BB </a></p>
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!