I know several ways to set anchor positioning in html, using id positioning, using name positioning, and using js positioning. You can refer to these methods below.
I know several ways to set anchor positioning in html, and I would like to share them with you:
1. Use id positioning:
The code is as follows:
<a href="#1F" name="1F">锚点1</a> <p name="1F"> <p> 11111111111 </br> 11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br>11111111111 </br> </p> </p>
Such positioning can be targeted at any tag.
2. Use name positioning:
The code is as follows:
<a href="#5F">锚点5</a> </br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br> <a name="5F">1111111</href>
The name attribute can only be used to position the a tag, but not other tags such as p. Play a positioning role.
3. Use js positioning
The code is as follows:
<li class="" onclick="javascript:document.getElementById('here').scrollIntoView()"></li>