Home  >  Article  >  Web Front-end  >  The solution to the invalid visit in the a tag pseudo-class in HTML

The solution to the invalid visit in the a tag pseudo-class in HTML

黄舟
黄舟Original
2017-07-27 13:27:513211browse

The solution to the invalid visited in the a tag pseudo-class in html

<html>
	<head>
		<title>伪类超链接</title>
		<!--<link href="./test.css" type="text/css" rel="stylesheet"></link>-->
		<style type="text/css">
			a:link {
				color:red;
				font-size:20px;
			}		
			a:visited {
				color:black;
				font-size:22px;
			}
			a:hover {
				color:yellow;
				font-size:22px;
			}
			a:active {
				color:green;
				font-size:24px;
			}

			table{
				width:200px;
				height:200px;
				background-color:pink;
			}
			body{
				margin-left:0;
				margin-top:0;
			}

		</style>
	</head>
	<body>
		<a href="./test.html" target="_blank">这是一个伪类的超链接</a>

	</body>
</html>

Recently. In the above simple test, first create a test.html and then write the above code in test2. You can find that a:visited

does not seem to work, so I went online to find relevant information:

It is said online that 4 pseudo-classes should be sorted in the order of my above code, no problem.

There was no way, I had to try Baidu

<span style="white-space:pre">	
</span>
<body>
<a href="http://www.baidu.com" target="_blank">百度</a>
<pre name="code" class="html">
<span style="white-space:pre">		
</span>
<a href="./test.html" target="_blank">这是一个伪类的超链接</a>
</body>

The problem came out. Baidu, which I didn't click on, turned black as soon as it came out.

The test.html that I clicked countless times did not change after clicking.

So, I made a bold guess, historical records.

Yes, after I cleared the browser history and refreshed the page, the Baidu hyperlink turned red directly.

After I clicked, it turned black according to the program. Refresh the page again, still black.

Looking through the history records, there is no history record about test.html. (It is recommended to use browsers such as Chrome, which can leave a history of running local files, and I will never use other messy browsers in the future.) So no matter how you click, it will still display the original red color.

So when we usually practice this, because there is no history record left on the browser, after clicking, the browser does not know that we have clicked and there is no application. :visited pseudo-class. Let us feel that a:visited is useless.

The above is the detailed content of The solution to the invalid visit in the a tag pseudo-class in HTML. 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