Hyperlink defines anchor

Hyperlink defines anchor

When you click a hyperlink, you jump directly to the position defined by the anchor point. For example, sometimes a "back to top" prompt appears after opening a web page, and you can click to go back to the top directly. The example picture is as follows:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<!-- 
	超链接定义锚点
	超链接找锚点
	 <a href="#锚点名称">链接名称</a>
	 
	 定义锚点
	 <a name="名称">aaa</a>
	 -->
	<body>
		<h3> <a name="top"></a></h3>
		<a href="#p1">产品1</a>
		<a href="#p2">产品2</a>
		<a href="#p3">产品3</a>
		<a href="#p4">产品4</a>
		<a href="#p5">产品5</a>
		<hr >
		<h3> <a name="p1">产品1</a></h3>
		<img src="img/nike/1.png" />
		<h3> <a name="p2">产品2</a></h3>
		<img src="img/nike/2.png" />
		<h3> <a name="p3">产品3</a></h3>
		<img src="img/nike/3.png" />
		<h3> <a name="p4">产品4</a></h3>
		<img src="img/nike/4.png" />
		<h3> <a name="p1">产品5</a></h3>
		<img src="img/nike/5.png" />
		<!-- 设置“返回顶部”的锚点点击可以迅速返回最顶部 -->
		<h3 align="right"><a href="#top">返回顶部</a></h3>
		
	</body>
</html>

Guess you like

Origin blog.csdn.net/crraxx/article/details/109191890