Home
Web Front-end
HTML Tutorial
Introduction to the use of anchor points (named anchors) in html web pages_HTML/Xhtml_Web page production



Introduction to the use of anchor points (named anchors) in html web pages_HTML/Xhtml_Web page production
May 16, 2016 pm 04:39 PM
html
anchor point
The following information is compiled from the Internet
1. Anchor point is a type of hyperlink in web page production, also called named anchor . A named anchor is a hyperlink within a page, like a quick locator, and is quite commonly used.
English name: anchor
Use named anchors to set tags in the document. These tags are usually placed at a specific topic or at the top of the document. Links to these named anchors can then be created that quickly take visitors to the specified location.
Creating a link to a named anchor is a two-step process. First, create a named anchor, and then create a link to the named anchor.
Sample code
Define the following anchor point at the appropriate position in the HTML page:
<a name="top">Here is the TOP part< ;/a>
<a name="content">This is the CONTENT part</a>
<a name="foot">This is the FOOT part</a>
(You can use the id attribute instead of the name attribute, and named anchors are also valid. [1])
There are two methods for accessing the above anchor points
One is to use the hyperlink tag <a>< /a>Create anchor links, mainly used for anchor access within the page
<a href="#top">Click my link to TOP</a>
<a href="# content">Click me to link to CONTENT</a>
<a href="#foot">Click me to link to FOOT</a>
Another way is to add it directly after the page address Anchor tags are mainly used for anchor access between different pages
If the address of this page is http://file path/index.html, to access the foot anchor, just access the following link
http ://File path/index.html#foot
2.html What exactly is the anchor point for?
To put it simply, for example, if you want to read a long article accurately by segment, you can use anchor points.
Code:
<a href="#001">Jump to 001</a>
...Text omitted
<a name="001" id= "001" ></a>
... Text omitted
In fact, the anchor point only needs a name, and the id is added to make it more compatible.
href The value must be consistent with name i d, and "#" must be added in front. The above code is compatible in ie6/7, ff, but not in ie8.
Because the <a></a> value of our anchor point is empty, we can just add a space so as not to affect the aesthetics.
The following code is compatible with IE8
< ;a href="#001">Jump to 001</a>
...Text omitted
<a name="001" id="001" > & n b s p </a>
...Text omitted
Another question, do you want to display a certain anchor content of a certain page (such as: 123.html)?
The code is as follows
<a href="123.html#001">Jump to 001</a>
... Text omitted
<a name="001 " id="001" > & n b s p </a>
... text omitted
This was yesterday when I was working on the background. I wanted to "modify positioning", so I moved the anchor mark. came out (usually it is forgotten by me).
But the program said that to get the value, there must be "?" or "&" in the connection, so my anchor point is incompatible...
Haha! There will be a solution in the future!
Although there is a problem with anchor point compatibility in jsp pages, there is no problem in static pages, and it is still worth learning!
3. In WEB development, page anchor will be used. HTML page anchors are used to link to a section of a page. W3School says that creating anchors uses the <a> (anchor) tag and the name attribute, but this is not the only way to create page anchors. Let’s briefly talk about two ways to make HTML page anchors.
We can use W3School’s online testing tool for testing. The test code after opening the link uses <a href=”#C4″> and <a name=”C4″>, and there is no problem in the test. Then change "<h2> <a name="C4″>Chapter 4 </a> </h2>" to "<h2 id="C4″>Chapter 4 </h2> "After testing, the effect is the same.
Note that in addition to using the name attribute of the anchor tag when making a page anchor, you can also use the id attribute. The value of the href attribute in the anchor<a> tag is the value starting with # plus the name or id of the target:
<html>
<body>
<p>
<a href="#method1">Page anchor method one</a>
</p>
<p>
<a href="#method2">Page anchor method two</a>
</p>
< h2><a name="method1">Method 1</a></h2>
<p>Use the href and name attributes of the anchor tag</p>
<h2 id="method2">Method 2</h2>
<p>Use anchor tag and id attribute</p>
</body>
</html>
1. Anchor point is a type of hyperlink in web page production, also called named anchor . A named anchor is a hyperlink within a page, like a quick locator, and is quite commonly used.
English name: anchor
Use named anchors to set tags in the document. These tags are usually placed at a specific topic or at the top of the document. Links to these named anchors can then be created that quickly take visitors to the specified location.
Creating a link to a named anchor is a two-step process. First, create a named anchor, and then create a link to the named anchor.
Sample code
Define the following anchor point at the appropriate position in the HTML page:
<a name="top">Here is the TOP part< ;/a>
<a name="content">This is the CONTENT part</a>
<a name="foot">This is the FOOT part</a>
(You can use the id attribute instead of the name attribute, and named anchors are also valid. [1])
There are two methods for accessing the above anchor points
One is to use the hyperlink tag <a>< /a>Create anchor links, mainly used for anchor access within the page
<a href="#top">Click my link to TOP</a>
<a href="# content">Click me to link to CONTENT</a>
<a href="#foot">Click me to link to FOOT</a>
Another way is to add it directly after the page address Anchor tags are mainly used for anchor access between different pages
If the address of this page is http://file path/index.html, to access the foot anchor, just access the following link
http ://File path/index.html#foot
2.html What exactly is the anchor point for?
To put it simply, for example, if you want to read a long article accurately by segment, you can use anchor points.
Code:
<a href="#001">Jump to 001</a>
...Text omitted
<a name="001" id= "001" ></a>
... Text omitted
In fact, the anchor point only needs a name, and the id is added to make it more compatible.
href The value must be consistent with name i d, and "#" must be added in front. The above code is compatible in ie6/7, ff, but not in ie8.
Because the <a></a> value of our anchor point is empty, we can just add a space so as not to affect the aesthetics.
The following code is compatible with IE8
< ;a href="#001">Jump to 001</a>
...Text omitted
<a name="001" id="001" > & n b s p </a>
...Text omitted
Another question, do you want to display a certain anchor content of a certain page (such as: 123.html)?
The code is as follows
<a href="123.html#001">Jump to 001</a>
... Text omitted
<a name="001 " id="001" > & n b s p </a>
... text omitted
This was yesterday when I was working on the background. I wanted to "modify positioning", so I moved the anchor mark. came out (usually it is forgotten by me).
But the program said that to get the value, there must be "?" or "&" in the connection, so my anchor point is incompatible...
Haha! There will be a solution in the future!
Although there is a problem with anchor point compatibility in jsp pages, there is no problem in static pages, and it is still worth learning!
3. In WEB development, page anchor will be used. HTML page anchors are used to link to a section of a page. W3School says that creating anchors uses the <a> (anchor) tag and the name attribute, but this is not the only way to create page anchors. Let’s briefly talk about two ways to make HTML page anchors.
We can use W3School’s online testing tool for testing. The test code after opening the link uses <a href=”#C4″> and <a name=”C4″>, and there is no problem in the test. Then change "<h2> <a name="C4″>Chapter 4 </a> </h2>" to "<h2 id="C4″>Chapter 4 </h2> "After testing, the effect is the same.
Note that in addition to using the name attribute of the anchor tag when making a page anchor, you can also use the id attribute. The value of the href attribute in the anchor<a> tag is the value starting with # plus the name or id of the target:
Copy code
The code is as follows:<html>
<body>
<p>
<a href="#method1">Page anchor method one</a>
</p>
<p>
<a href="#method2">Page anchor method two</a>
</p>
< h2><a name="method1">Method 1</a></h2>
<p>Use the href and name attributes of the anchor tag</p>
<h2 id="method2">Method 2</h2>
<p>Use anchor tag and id attribute</p>
</body>
</html>
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

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How do you parse and process HTML/XML in PHP?
