Home  >  Article  >  Web Front-end  >  Detailed explanation of examples of hyperlinks in XHTML

Detailed explanation of examples of hyperlinks in XHTML

巴扎黑
巴扎黑Original
2017-05-22 10:39:151654browse

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 3499910bf9dac5ae3c52d5ede73834855db79b134e9f6b82c0b36e0489ee08ed tag to define a hyperlink, syntax:
fc159e4df4396fdfe915f8d499d3bef4Displayed text or image5db79b134e9f6b82c0b36e0489ee08ed
Example:

XML/HTML CodeCopy content to clipboard

链接至百度
  1. Browser display effect:

  2. Link to Baidu

  3. 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

p+CSS教程
  1. 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

链接至百度
  1. 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.

  2. Tip

  3. 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.

  4. 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

联系xyz站的站长
  1. 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

  1. Create a hyperlink address linking to the anchor:

XML/HTML CodeCopy content to clipboard

链接至comment锚

  1. 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).

  2. Tip

  3. 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.

  4. You can also create an anchor tag that links to other pages, for example:

XML/HTML CodeCopy content to clipboard

链接至锚

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】

1. HTML Free Video Tutorial

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!

Statement:
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