Home >Web Front-end >HTML Tutorial >Common ways to set anchor positioning in html

Common ways to set anchor positioning in html

高洛峰
高洛峰Original
2017-03-02 14:57:451965browse

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


##For more related articles on common methods of setting anchor positioning in HTML, please Follow 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