Home  >  Article  >  Web Front-end  >  How to set anchor positioning in html? Summary of setting anchor point positioning methods

How to set anchor positioning in html? Summary of setting anchor point positioning methods

云罗郡主
云罗郡主forward
2018-10-09 14:11:116179browse

A lot of html will encounter anchor positioning, so how to set anchor positioning in html? Let's summarize what are the methods for setting anchor positioning in HTML? And summarize the methods of setting anchor positioning in html.

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 label.

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>

Using 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(&#39;here&#39;).scrollIntoView()"></li>

The above is how to set anchor positioning in html? A comprehensive introduction to setting up anchor point positioning methods. If you want to know more about HTML tutorials, please pay attention to phpphilanthropic training.

The above is the detailed content of How to set anchor positioning in html? Summary of setting anchor point positioning methods. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete