May 03, 2021 HTML5
The main purpose of HTML5 and lt;a-gt; tags is to be used for hyperlinks, which can be linked to other pages or to other files locally, and you can get to know the labels in this example below.
Link to the W3Cschool tutorial :
All major browsers support the hashtag.
Labels define hyperlinks that are used to link from one page to another.
The most important property of an element is the href property, which specifies the target of the link.
In all browsers, the default appearance of the link is as follows:
Tip: If you don't use the href property, you can't use the hreflang, media, rel, target, and type properties.
Tip: Linked pages are usually displayed in the current browser window unless additional targeting is specified.
Tip: Use CSS to change the style of the link.
In HTML 4.01, a label can be neither a hyperlink nor an anchor. In HTML5, the label is a hyperlink, but if there is no href property, it is only a placeholder for the hyperlink.
HTML5 has some new properties and no longer supports some HTML 4.01 properties.
New: The new property in HTML5.
Property | Value | Describe |
---|---|---|
charset | char_encoding | HTML5 is not supported. Specifies the character encoding of the target URL. |
coords | coordinates | HTML5 is not supported. Specifies the coordinates of the link. |
download New | filename | Specify the download link |
Href | Url | Specify the target URL of the link. |
hreflang | language_code | Specifies the base language of the target URL. Use only when the href property exists. |
media New | media_query | Specifies the media type of the target URL. D efault: all. Use only when the href property exists. |
name | section_name | HTML5 is not supported. Specify the name of the anchor. |
rel |
alternate
author bookmark help license next nofollow noreferrer prefetch prev search tag |
Describes the relationship between the current document and the target URL. Use only when the href property exists. |
rev | text | HTML5 is not supported. Specify the relationship between the target URL and the current document. |
shape |
default
rect circle poly |
HTML5 is not supported. Specifies the shape of the link. |
target |
_blank
_parent _self _top framename |
Specify where to open the destination URL. Use only when the href property exists. |
type New | MIME_type |
Specifies the type of MIME for the target URL. U
se only when the href property exists.
Note: MIME - Multipurpose Internet Extension Mails. |
Labels support the global properties of HTML.
The tag supports the event properties of HTML.
Create a hyperlink
This example shows how to create a link in an HTML document.
Use the image as a link
This example shows how to use an image as a link.
Open the link in a new browser window
This example shows how to open a page in a new window so that visitors don't have to leave your site.
Create an e-mail link
This example shows how to link to a message. (
This example does not work until the mail client program is installed.)
)
Create an e-mail link 2
This example demonstrates more complex mail links.
Use anchors to jump to different locations on the same page
This example shows how to use the anchor's id property to jump to a different location on the page (HTML5 does not support the name property).
HTML tutorial: HTML links
HTML DOM Reference Manual: Anchor Object