


Introduction to the use of anchor points (named anchors) in html web pages
You must be familiar with anchor points in HTML. Anchors are a type of hyperlink in web page production, also called named anchors. The following is an example of how to use anchor points. If you don’t understand, Friends, don’t miss it
The following information is compiled from the Internet
1. Anchor point is a type of hyperlink in web page production, also called named anchor remember. A named anchor is a hyperlink within a page, like a quick locator, and is widely used.
English name: anchor
Use named anchors to set tags in the document. These tags are usually placed at or at the top of a specific topic in the document. Links to these named anchors can then be created that quickly take visitors to the specified location.
The process of 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 location in the HTML page:
<a name="top">这里是TOP部分</a> <a name="content">这里是CONTENT部分</a> <a name="foot">这里是FOOT部分</a>
(You can use the id attribute instead name attribute, named anchors are also valid. [1])
There are two methods for accessing the above anchors
One is to use the hyperlink tag to create an anchor link, mainly Used for anchor point access within the page
<a href="#top">点击我链接到TOP</a> <a href="#content">点击我链接到CONTENT</a> <a href="#foot">点击我链接到FOOT</a>
Another way is to add the anchor point mark directly after the page address, mainly used for anchor point access between different pages
If this page The address is http://file path/index.html. To access the foot anchor, just access the following link
http://file path/index.html#foot
2.html anchor What exactly is the 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">跳到001</a> ...文字省略 <a name="001" id="001" ></a> ...文字省略
In fact, the anchor point only needs name. The id is added to make it more compatible.
The value of href must be consistent with name \ i d, as shown above "#" must be added. The above code is compatible in ie6/7 and ff, but not in ie8.
Because the value of our anchor point is empty, we can just add a space so as not to affect the appearance.
The following code will be compatible with ie8
<a href="#001">跳到001</a> ...文字省略 <a name="001" id="001" > & n b s p </a> ...文字省略
Another question, do you want to display the anchor content of a certain page (such as: 123.html)?
The code is as follows
<a href="123.html#001">跳到001</a> ...文字省略 <a name="001" id="001" > & n b s p </a> ...文字省略
This is yesterday when I was working on the background. I wanted to implement "modify positioning", so I moved the anchor mark 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 will be 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 certain section of a page. W3School says that creating anchors uses the (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 to conduct testing. The test code after opening the link uses and , and there is no problem in the test. Then change " Explanation, 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 tag is starting with # plus the value of the target's name or id:
##Copy code
The code is as follows:<html> <body> <p> <a href="#method1">页面锚点方法一</a> </p> <p> <a href="#method2">页面锚点方法二</a> </p> <h2 id="a-nbsp-name-method-方法一-a"><a name="method1">方法一</a></h2> <p>使用锚标签的 href 和 name 属性</p> <h2 id="方法二">方法二</h2> <p>使用锚标签和 id 属性</p> </body> </html>
Related recommendations:
##How to use multiple examples to parse HTML form
The above is the detailed content of Introduction to the use of anchor points (named anchors) in html web pages. For more information, please follow other related articles on the PHP Chinese website!

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.