A – Hyperlink (CHANGED) - HTML5 - W3C On GitHub
Có thể bạn quan tâm
HTML: The Markup Language (an HTML language reference)
« elements abbr »ⓘ a – hyperlink CHANGED # T
The a element represents a hyperlink.
Permitted contents #
transparent (either phrasing content or flow content )
Permitted attributes #
global attributes & href & target & rel & hreflang & media & type
ⓘ global attributes Any attributes permitted globally. ⓘ href = URL potentially surrounded by spaces # A URL that provides the destination of the hyperlink. If the href attribute is not specified, the element represents a placeholder hyperlink. ⓘ target = browsing-context name or keyword CHANGED # A name or keyword giving a browsing context for UAs to use when following the hyperlink. The target attribute on the a element was deprecated in a previous version of HTML, but is no longer deprecated, as it useful in Web applications, particularly in combination with the iframe element. Any string that is either of the following:- a browsing-context name
- any case-insensitive match for one of the following literal strings: "_blank", "_self", "_parent", or "_top".
Additional constraints and admonitions #
- The interactive element a must not appear as a descendant of the a element.
- The interactive element a must not appear as a descendant of the button element.
- The coords attribute on the a element is obsolete. For image maps, use the area element instead of the a element.
- The shape attribute on the a element is obsolete. For image maps, use the area element instead of the a element.
- The urn attribute on the a element is obsolete. Specify the preferred persistent identifier using the href attribute instead.
- The charset attribute on the a element is obsolete. Use an HTTP Content-Type header on the linked resource instead.
- The methods attribute on the a element is obsolete. Use the HTTP OPTIONS feature instead.
- The rev attribute on the a element is obsolete. Use the rel attribute instead, with a term having the opposite meaning.
- The name attribute on the a element is obsolete. Consider putting an id attribute on the nearest container instead.
Tag omission #
An a element must have both a start tag and an end tag.
Permitted parent elements #
any element that can contain phrasing elements, any element that can contain flow elements
Changes in HTML5 #
Although previous versions of HTML restricted the a element to only containing phrasing content (essentially, what was in previous versions referred to as “inline” content), the a element is now transparent; that is, an instance of the a element is now allowed to also contain flow content (essentially, what was in previous versions referred to as “block” content)—if the parent element of that instance of the a element is an element that is allowed to contain flow content.
Details #
If the contents of an a element are empty, the element represents an empty hyperlink.
DOM interface #
interface HTMLAnchorElement : HTMLElement { stringifier attribute DOMString href; attribute DOMString target; attribute DOMString rel; readonly attribute DOMTokenList relList; attribute DOMString media; attribute DOMString hreflang; attribute DOMString type; attribute DOMString text; // URL decomposition IDL attributes attribute DOMString protocol; attribute DOMString host; attribute DOMString hostname; attribute DOMString port; attribute DOMString pathname; attribute DOMString search; attribute DOMString hash; };Typical default display properties #
a:link, a:visited { color: (internal value); text-decoration: underline; cursor: auto; } a:link:active, a:visited:active { color: (internal value); }Examples #
A hyperlink intended to be useful in output for all media types except the print media type.
<a href="./page2.html" rel=next media="not print">next</a>The name attribute is obsolete.
<a name="section5"/>A placeholder hyperlink.
<a>prev</a>A hyperlink that will cause its target to be opened in a new browsing context.
<a href="http://help.example.com" target="_blank">Help</a>The value of the href attribute contains a space character.
some <a href="http://example.com/Archive/Public Data/">public</a> data is also availableA hyperlink that represents multiple link types.
<a href="../toc.html" rel="index up">up</a>A hyperlink that contains a paragraph.
<a href="javascript:void(0);" onmouseover="return anno('Note: This paragraph is informative only.') onmouseout="return anno_bye();"> <p>The following is introductory information…</p> </a> « elements abbr »Từ khóa » Html5 A Tag
-
HTML A Tag - W3Schools
-
HTML Element Reference - W3Schools
-
: The Anchor Element - HTML: HyperText Markup Language | MDN
-
List Of HTML5 Tags/Elements - Tutorial Republic
-
HTML5 - Tags Reference - Tutorialspoint
-
HTML5 - New Tags (Elements) - Tutorialspoint
-
HTML Tag - GeeksforGeeks
-
HTML5 Semantic Tags: What They Are And How To Use Them!
-
HTML5 Navigation: How To Use Anchor Tags For Hypertext
-
HTML And CSS Tutorial - Nanyang Technological University
-
WebD2: Common HTML Tags - University Of Washington
-
HTML5 Tags | Newly Introduced Elements Exclusively In ... - EduCBA
-
The HTML Comment Tag: Here's How To Use It In Your Code »