Several common methods for setting anchor positioning in HTML

Several common methods for setting anchor positioning in HTML
There are several ways I know of to set anchor positioning in HTML, let me share them with you:

1. Use id positioning:

Copy code
The code is as follows:

<a href="#1F" name="1F">Anchor Point 1</a>
<div 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>
</div>

This positioning can be targeted at any label.

2. Use name positioning:

Copy code
The code is as follows:

<a href="#5F">Anchor Point 5</a>
</br></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 locate the a tag, but it cannot be used to locate other tags such as div.

3. Use js positioning

Copy code
The code is as follows:

<li class="" onclick="javascript:document.getElementById('here').scrollIntoView()"></li>

<<:  Summary of @ usage in CSS (with examples and explanations)

>>:  Detailed explanation of Docker compose orchestration tool

Recommend

VMware ESXI server virtualization cluster

Table of contents summary Environment and tool pr...

CSS to achieve the effect of rotating flip card animation

The css animation of the rotating flip effect, th...

How to implement remote access control in Centos 7.4

1. SSH remote management SSH is a secure channel ...

jQuery plugin to achieve seamless carousel

Seamless carousel is a very common effect, and it...

Sample code for JS album image shaking and enlarging display effect

The previous article introduced how to achieve a ...

A detailed analysis of the murder caused by a misplaced double quote in MySQL

1. Introduction Recently, I often encounter devel...

Introduction to common MySQL storage engines and parameter setting and tuning

MyISAM, a commonly used storage engine in MySQL c...

Using shadowsocks to build a LAN transparent gateway

Table of contents Install and configure dnsmasq I...

Three ways to implement text color gradient in CSS

In the process of web front-end development, UI d...

Linux uses iptables to limit multiple IPs from accessing your server

Preface In the Linux kernel, netfilter is a subsy...

Detailed steps to expand LVM disk in Linux

1. Add a hard disk 2. Check the partition status:...

Five ways to traverse objects in javascript Example code

Table of contents Prepare Five weapons for…in Obj...

About the problem of writing plugins for mounting DOM in vue3

Compared with vue2, vue3 has an additional concep...

How to implement h5 input box prompt + normal text box prompt

XML/HTML CodeCopy content to clipboard < input...