May 04, 2021 HTML Reference Manual
Labels are used to define hyperlinks that link from one page to another.
The most important property of a label is the href property, which is used to create a link (or hyperlink) to another document.
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.
Set the anchor link within the p-label
Set the external page of the link anchor element
New : The new property in HTML5.
属性 | 值 | 描述 |
---|---|---|
charset | char_encoding | HTML5 不支持。 规定目标 URL 的字符编码。 |
coords | coordinates | HTML5 不支持。 规定链接的坐标。 |
download New | filename | 指定下载链接 |
href | URL | 规定链接的目标 URL。 |
hreflang | language_code | 规定目标 URL 的基准语言。仅在 href 属性存在时使用。 |
media New | media_query | 规定目标 URL 的媒介类型。默认值:all。仅在 href 属性存在时使用。 |
name | section_name | HTML5 不支持。 规定锚的名称。 |
rel |
alternate
author bookmark help license next nofollow noreferrer prefetch prev search tag |
规定当前文档与目标 URL 之间的关系。仅在 href 属性存在时使用。 |
rev | text | HTML5 不支持。 规定目标 URL 与当前文档之间的关系。 |
shape |
default
rect circle poly |
HTML5 不支持。 规定链接的形状。 |
target |
_blank
_parent _self _top framename |
规定在何处打开目标 URL。仅在 href 属性存在时使用。 |
type New | MIME_type |
规定目标 URL 的 MIME 类型。仅在 href 属性存在时使用。
注:MIME = Multipurpose Internet Mail Extensions。 |
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