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

Common ways to set anchor positioning in html

高洛峰
Release: 2017-03-02 14:57:45
Original
1952 people have browsed it

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>
Copy after login


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>
Copy after login


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>
Copy after login


##For more related articles on common methods of setting anchor positioning in HTML, please Follow PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template