HTML webpage production: making anchor links

1. Anchor link definition:

It means that when I click on a certain link (anchor link) on the page, I will jump to the specified position (anchor) on this page.

2. Steps of anchor link:

(1), set the anchor point: <a name="anchor point name" ></a>

It means to insert an anchor point at a certain position in the webpage.

(2), set the anchor link: <a href=" #锚点的名字"> point I will jump to the anchor point </a>

It means that the anchor point set before the link in a certain position on the webpage, as long as the link is clicked, it will automatically jump to the anchor point.

(3) At this time, clicking on the anchor link will jump to the anchor point.

3. Examples:

The back to top button in many websites is made with anchors.

<p name="top" id="top">这里是顶部</p>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<a href="#top">回到顶部</a>

Usually the anchor point definition only needs to write the name attribute, but in xhtml more formally, you need to write the id.

 

Reference link:

https://jingyan.baidu.com/article/a3f121e4e51d38fc9052bb86.html

https://zhidao.baidu.com/question/679356986603917492.html

Guess you like

Origin blog.csdn.net/cherry_vicent/article/details/113072864