This article mainly introduces the tutorial on using hyperlink tags in XHTML, including an introduction to the usage of anchor links and link relative addresses. Friends in need can refer to
Hyperlinks, also called " Link". Hyperlinks can be said to be everywhere on the web pages we browse. When we click on a link address on a web page, it links to another web page. This is how hyperlinks work.
Use the tag to define a hyperlink, syntax:
Displayed text or image
Example:
XML/HTML CodeCopy content to clipboard
<a href="http://www.baidu.com/">链接至百度</a>
Browser display effect:
Link to Baidu
When we click on the words "Link to Baidu" above, the browser will redirect to the Baidu homepage.
Hyperlink attribute
Hyperlink attribute:
href link address. It can be an absolute web address or a relative address.
target Link target. A value of _blank will open the link address in a new window. By default, the current window will be used to open the link address.
name Anchor link, we will talk about this separately below.
Relative web link address:
XML/HTML CodeCopy content to clipboard
<a href="/css" target="_blank">p+CSS教程</a>
This example uses a relative address, while the example linking to Baidu above uses an absolute address.
Example of added target attribute:
XML/HTML CodeCopy content to clipboard
<a href="http://www.baidu.com/" target="_blank">链接至百度</a>
When you click the link again, the browser will enable a new page to open the link address, while the original page window will be retained.
Tip
When a link address is not very closely related to the current topic or process, the target="_blank" attribute is usually enabled. Otherwise, try not to open new windows in order to provide viewers with a friendly browsing experience.
If the page is composed of several page frames, the target attribute can also have other values
Email hyperlink
Email link example:
XML/HTML CodeCopy content to clipboard
<a href="mailto:admin@xyz.com">联系xyz站的站长</a>
Clicking this link will enable your default email client to compose your email.
Anchor link
Anchor link refers to the link within the page, but now many people also call text hyperlinks anchor links.
Let’s take an example to explain the role of anchors:
For example, we have a well-written article, and many people have commented after the article, and the window for commenting is usually at the bottom of the comment. Location. The website will set an anchor link where the comment is posted, and design a link to the anchor link where the comment is displayed, such as: "Post a comment." If someone does not want to view the comments left by others and wants to jump to the comment input window immediately, then click "Post a Comment" to quickly jump to the comment input window within the industry. This design undoubtedly improves the user experience for viewers.
Example of using anchor links
Create anchor:
XML/HTML CodeCopy content to clipboard
<p><a name="comment"></a></p>
Create a hyperlink address linking to the anchor:
XML/HTML CodeCopy content to clipboard
<p><a href="#comment">链接至comment锚</a></p>
As you can see from the example, to access an anchor, just add the "#" sign and the name of the anchor after the link address. In the above example, since it is an anchor linking to this page, the previous link address is ignored (note: the relative address is actually ignored, and will not be discussed here).
Tip
If you want to experiment with the use of this anchor tag, be careful to combine the hyperlink that links to the anchor with the anchor tag. Only by maintaining enough web page space can you see the effect. You can use the line break tags we learned above to create enough white space above and below to test.
You can also create an anchor tag that links to other pages, for example:
XML/HTML CodeCopy content to clipboard
<p><a href="http://www.abc.com/#test">链接至锚</a></p>
Of course, the page www.abc.com needs to have this test anchor tag, otherwise it will only link to the www.abc.com page and ignore this anchor Tag
【Related Recommendations】
2. Picture and text explanation of HTTP Headers knowledge points
3. Introduction to how to display JSON data in html
4. htmlDetailed explanation of the example of implementing the quantity subscript on the message button
5. HtmlJquery code example to complete asynchronous upload of files
The above is the detailed content of Detailed explanation of examples of hyperlinks in XHTML. For more information, please follow other related articles on the PHP Chinese website!

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.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

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

Atom editor mac version download
The most popular open source editor

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