4.html5 hyperlink, 4.html 5 hyperlink

Source: Internet
Author: User

4.html5 hyperlink, 4.html 5 hyperlink

In html, The superlinks are implemented through <a> tags, and html5 is no exception. Here we will discuss <a> tags.

<A> an element is a text element and has private or local attributes. Therefore, the corresponding General attribute or global attribute will be discussed later.

The following table lists the private attributes:

Attribute name Description
Href Specify the URL of the resource specified by the <a> element
Hreflang The language of the linked resource.
Media Indicates the device to which the linked resource is used.
Rel Description of the relationship between the document and the linked Resource
Target Used to open the browsing environment of the linked Resource
Type Description of the MIME type of the linked Resource (for example, text/html)

Among these attributes, only href and target are commonly used, while href is required. The other attributes are rarely used in <a> elements and will be further discussed in CSS.

1. href attributes

<A href = "http://www.baidu.com"> Baidu </a>

 

Explanation: href is a required attribute. Otherwise, the <a> element becomes an empty element. If the attribute value is a URL starting with http: //, it means clicking to jump to the specified external website. However, if it is in the following form, it indicates that the anchor is used:

// Link to <a href = "#1"> Chapter 1 </a> <a href = "#2"> Chapter 2 </a> <a href = "#3 "> Chapter 3 </a> // anchor <a name =" 1 "> </a> <a id =" 3 "> </a>

 

Explanation: the anchor is used to jump inside a page. When a page is very long, the elements cannot be displayed in a single view, this method is used to implement other elements on the page that the user clicks and jumps quickly.It uses the attribute id or name to locate the anchor.

 

2. target attributes

<A href = "http://www.baidu.com" target = "_ blank"> Baidu </a>

 

Explanation: The target attribute tells the browser where to display the linked resources. The effect varies depending on the value. The specific value is as follows:

Attribute Value Description
_ Blank Open a document in a new window or tab
_ Parent Open the document in the parent window frame group (frameset)
_ Self Open the document in the current window (default
_ Top Open a document in the top-level window

The four most common types are _ blank, which creates a window. _ Self is the default value. The current window is open. _ Parent and _ top are based on the Framework page, indicating opening in the parent window and opening in the whole window respectively. In HTML5, the framework is basically obsolete and can only use <iframe> elements. In the future, the framework will be rarely used in combination with JavaScript, PHP, and other languages.

Okay. <a> the summary of the elements is now ......

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.