<a>

  • Revision slug: Web/HTML/Element/a
  • Revision title: <a>
  • Revision id: 429685
  • Created:
  • Creator: jessiecaisme
  • Is current revision? No
  • Comment

Revision Content

总结Summary

 HTML的 <a>元素 (或HTML锚元素) 定义了一个超链接, 指定的目标目的地一个超链接,或者两者都是。

属性Attributes

该元素包括全局属性.

字符集 (已过时,因为html5){{obsoleteGeneric("inline","HTML5")}}
此属性定义链接资源的字符编码。该值是一个空格- 和/或逗号分隔的RFC 2045中定义的字符集列表默认值是ISO-8859-1。

使用说明: 在 HTML5 中该属性已作废,不应使用。 为了实现其效果,使用HTTP content - type header的链接资源。

坐标 [只有html4支持](过时的,因为HTML5){{htmlattrdef("coords")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}
对于使用对象的形状,这个属性使用逗号分隔的数字列表来定义对象在页面上的坐标。
绑定的字段DATAFLD)(不规范的){{htmlattrdef("datafld")}} {{Non-standard_inline}}
从该数据源绑定的数据对象,提供此属性指定列名。

使用说明: 该属性不规范,不应被使用. 为了实现其效果,使用脚本和一个机制如XMLHttpRequest来填充页面动态

支持 Gecko Presto WebKit Trident
不支持 不支持 不支持 IE4, IE5, IE6, IE7 ( IE8移除)
规范性文件 微软的数据绑定: 绑定的字段的属性 (MSDN)  
数据源(不规范的){{htmlattrdef("datasrc")}} {{Non-standard_inline}}

这个属性表示数据源对象的ID,供应的数据绑定到该元素。

使用说明: 该属性不规范,不应被使用为了实现其效果,使用脚本和一个机制如XMLHttpRequest来填充页面动态

支持 Gecko Presto WebKit Trident
不支持 不支持 不支持 IE4, IE5, IE6, IE7 (IE8移除)
规范性文件 微软的数据绑定: 数据源属性 (MSDN)
下载{{htmlattrdef("download")}} {{HTMLVersionInline(5)}}
此属性,如果存在,表明笔者拟用于下载资源的超级链接。如果属性有一个值,浏览器应该解释,作为默认的文件名,笔者建议使用本地文件系统中的资源标记。允许值没有任何限制,但你应该考虑大多数文件系统都用什么标点符号,在文件名支持方面的局限性,以及浏览器都可能调整相应的文件名。

注意事项:

  • 您可以使用此数据BLOB:文件系统:URLs,让用户很容易地去下载编程生成的内容。
  • 如果HTTP头的Content-Disposition:存在,并且给出了一个不同的文件名 和这个属性相比,HTTP头优先于此属性。
  • 如果这个属性存在Content-Disposition:被设置为内联,火狐优先考虑Content-Disposition,像文件名​​的情况下,而Chrome 下载属性优先
  • 这个属性在 Firefox 20 只授予相同来源的资源的链接。
链接{{htmlattrdef("href")}}

这是一个必需属性为锚定义一个超文本链接来源这表示链接目标的URL或URL片段。URL片段是由一个hash符号(#),它指定一个内部目标在当前文档中的位置(ID开头的名字。URL不限于网页(HTTP)的文件。URL可能使用浏览器所支持的任何协议。例如,文件FTP大多数用户代理mailto工作。

注意事项: 您可以使用“顶级”的特殊片段,以创建一个链接返回到页面顶部;为例如<a href="#top">返回顶部</ a>的这种行为在HTML5上被指定

{{htmlattrdef("hreflang")}}
This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by BCP47 for HTML5 and by RFC1766 for HTML4. Use this attribute only if the {{htmlattrxref("href", "a")}} attribute is present.
{{htmlattrdef("media")}} {{HTMLVersionInline(5)}}
This attribute specifies the media which the linked resource applies to. Its value must be a media query. This attribute is mainly useful when linking to external stylesheets by allowing the user agent to pick the best adapted one for the device it runs on.

Usage note:

  • In HTML 4, only simple white-space-separated list of media description literals, i.e. media types and groups, where defined and allowed as values for this attribute, like print, screen, aural, braille, ... HTML 5 extended this to any kind of media queries, which are a superset of the allowed values of HTML 4.
  • Browsers not supporting the CSS3 Media Queries won't necessarilly recognize the adequate link; do not forget to set fallback links, the restricted set of media queries defined in HTML 4.
{{htmlattrdef("methods")}} {{Non-standard_inline}}
The value of this attribute provides information about the functions that might be performed on an object. The values generally are given by the HTTP protocol when it is used, but it might (for similar reasons as for the title attribute) be useful to include advisory information in advance in the link. For example, the browser might choose a different rendering of a link as a function of the methods specified; something that is searchable might get a different icon, or an outside link might render with an indication of leaving the current site. This attribute is not well understood nor supported, even by the defining browser, Internet Explorer 4. Methods Property (MSDN)
{{htmlattrdef("name")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}
This attribute is required in an anchor defining a target location within a page. A value for name is similar to a value for the id core attribute and should be an alphanumeric identifier unique to the document. Under the HTML 4.01 specification, id and name both can be used with the <a> element as long as they have identical values.

Usage note: This attribute is obsolete in HTML5, use global attribute id instead.

{{htmlattrdef("ping")}} {{HTMLVersionInline(5)}}
The support for "ping" was disabled starting with Firefox 3 beta 3. {{Bug(415168)}}
{{htmlattrdef("rel")}}
For anchors containing the href attribute, this attribute specifies the relationship of the target object to the link object. The value is a space-separated list of relationship values. The values and their semantics will be registered by some authority that might have meaning to the document author. The default relationship, if no other is given, is void. Use this attribute only if the href attribute is present.
{{htmlattrdef("rev")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}
This attribute specifies a reverse link, the inverse relationship of the rel attribute. It is useful for indicating where an object came from, such as the author of a document.
Note: It is advisable to use the usemap attribute for the {{HTMLElement("img")}} element and the associated {{HTMLElement("map")}} element to define hotspots instead of the shape attribute.
{{htmlattrdef("shape")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}
This attribute is used to define a selectable region for hypertext source links associated with a figure to create an image map. The values for the attribute are circle, default, polygon, and rect. The format of the coords attribute depends on the value of shape. For circle, the value is x,y,r where x and y are the pixel coordinates for the center of the circle and r is the radius value in pixels. For rect, the coords attribute should be x,y,w,h. The x,y values define the upper-left-hand corner of the rectangle, while w and h define the width and height respectively. A value of polygon for shape requires x1,y1,x2,y2,... values for coords. Each of the x,y pairs defines a point in the polygon, with successive points being joined by straight lines and the last point joined to the first. The value default for shape requires that the entire enclosed area, typically an image, be used.
{{htmlattrdef("target")}}
This attribute specifies where to display the linked resource. In HTML4, this is the name of, or a keyword for, a frame. In HTML5, it is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame). The following keywords have special meanings:
  • _self: Load the response into the same HTML4 frame (or HTML5 browsing context) as the current one. This value is the default if the attribute is not specified.
  • _blank: Load the response into a new unnamed HTML4 window or HTML5 browsing context.
  • _parent: Load the response into the HTML4 frameset parent of the current frame or HTML5 parent browsing context of the current one. If there is no parent, this option behaves the same way as _self.
  • _top: In HTML4: Load the response into the full, original window, canceling all other frames. In HTML5: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as _self.
Use this attribute only if the href attribute is present.
{{htmlattrdef("type")}}
This attribute specifies the media type in the form of a MIME type for the link target. Generally, this is provided strictly as advisory information; however, in the future a browser might add a small icon for multimedia types. For example, a browser might add a small speaker icon when type is set to audio/wav. For a complete list of recognized MIME types, see http://www.w3.org/TR/html4/references.html#ref-MIMETYPES. Use this attribute only if the href attribute is present.
{{htmlattrdef("urn")}} {{Non-standard_inline}}
This supposedly Microsoft-supported attribute relates a uniform resource name (URN) with the link. While it is based on standards work years back, the meaning of URNs is still not well defined, so this attribute is meaningless. urn Property (MSDN)

Example

<!-- anchor linking to external file -->
<a href="http://www.mozilla.com/">
External Link
</a>

Result

External Link

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-a-element', '<a>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'the-a-element.html#the-a-element', '<a>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'struct/links.html#h-12.2', '<a>')}} {{Spec2('HTML4.01')}}  

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
href="#top" {{CompatVersionUnknown}} {{CompatGeckoDesktop("10.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
{{htmlattrxref("download","a")}} 14 {{CompatGeckoDesktop("20.0")}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
href="#top" {{CompatVersionUnknown}} {{CompatGeckoMobile("10.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
{{htmlattrxref("download","a")}} {{CompatVersionUnknown}} {{CompatGeckoMobile("20.0")}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}}

Notes

The following are reserved browser key bindings for the two major browsers and should not be used as values to accesskey: a, c, e, f, g, h, v, left arrow, and right arrow.

HTML 3.2 defines only name, href, rel, rev, and title.

The target attribute is not defined in browsers that do not support frames, such as Netscape 1 generation browsers. Furthermore, target is not allowed under strict variants of XHTML but is limited to frameset or transitional forms.

JavaScript recommendations

It is often the case that an anchor tag is used with the onclick event. In order to prevent the page from refreshing, href is often set to either "#" or "javascript:void(0)". Both of these values can lead to some unexpected errors when copying links and opening links in a new tab and/or window. Be aware of this for usability reasons, and when users do use anchor tags and you prevent default behavior.

See also

  • Other elements conveying text-level semantics: {{HTMLElement("abbr")}}, {{HTMLElement("em")}}, {{HTMLElement("strong")}}, {{HTMLElement("small")}}, {{HTMLElement("cite")}}, {{HTMLElement("q")}}, {{HTMLElement("dfn")}}, {{HTMLElement("time")}}, {{HTMLElement("code")}}, {{HTMLElement("var")}}, {{HTMLElement("samp")}}, {{HTMLElement("kbd")}}, {{HTMLElement("sub")}}, {{HTMLElement("sup")}}, {{HTMLElement("b")}}, {{HTMLElement("i")}}, {{HTMLElement("mark")}}, {{HTMLElement("ruby")}}, {{HTMLElement("rp")}}, {{HTMLElement("rt")}}, {{HTMLElement("bdo")}}, {{HTMLElement("span")}}, {{HTMLElement("br")}}, {{HTMLElement("wbr")}}.
{{HTML:Element_Navigation}}

Revision Source

<h2 id=".E6.80.BB.E7.BB.93Summary">总结Summary</h2>
<p>&nbsp;<em>HTML的 <code>&lt;a&gt;元素</code></em> (或HTML锚元素) 定义了一个超链接, 指定的目标目的地一个超链接,或者两者都是。</p>
<ul class="htmlelt">
  <li><dfn><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">内容分类</a></dfn><a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Flow_content" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);" title="HTML /内容类别#流内容"><font><font>&nbsp; 流内容</font></font></a><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);"><font>,</font></font><a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);" title="HTML /内容类别#措词内容"><font><font>表述内容</font></font></a><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);"><font>,互动的内容,可触的内容。</font></font></li>
  <li><dfn>允许内容&nbsp;</dfn>&nbsp; <a href="/en-US/docs/HTML/Content_categories#Transparent_content_model" title="HTML/Content_categories#Transparent_content_model">透明</a>,要么<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Flow_content" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);" title="HTML / Content_categories的#Flow_content"><font><font>流内容</font></font></a>要么<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);" title="HTML /内容类别#措词内容"><font><font>表述内容</font></font></a>。</li>
  <li><dfn>标签遗漏</dfn>&nbsp; 无,开始和结束标签都是强制的。</li>
  <li><dfn>允 许 父 元 素</dfn>&nbsp; 任何元素都接受<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);" title="HTML /内容类别#措词内容"><font><font>表述内容</font></font></a>或<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Flow_content" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 238, 153);" title="HTML /内容类别#流内容"><font><font>流内容</font></font></a>.</li>
  <li><dfn>DOM接口&nbsp;&nbsp;&nbsp; </dfn>&nbsp; DOM HTML锚元素的接口</li>
</ul>
<h2 id=".E5.B1.9E.E6.80.A7Attributes">属性Attributes</h2>
<p><span style="line-height: 21px;">该元素包括</span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">全局属性</a><span style="line-height: 21px;">.</span></p>
<dl>
  <dt>
    字符集 (已过时,因为html5){{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    <font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font>此属性定义链接资源的字符编码。</font><font>该值是一个空格- 和/或逗号分隔的</font></font><a class="external" href="http://tools.ietf.org/html/rfc2045" style="color: rgb(102, 153, 204); text-decoration: none; padding-right: 16px; background-image: url(https://developer.cdn.mozilla.net/media/img/wiki/icons/link_external.png); background-color: rgb(255, 255, 255); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-position: 99% 40%; background-repeat: no-repeat no-repeat;" title="http://tool​​s.ietf.org/html/rfc2045"><font><font>RFC 2045</font></font></a><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font>中定义的字符集列表</font><font>。</font><font>默认值是ISO-8859-1。</font></font>
    <div class="note">
      <p><strong>使用说明: </strong>在 HTML5 中该属性已作废,不应使用。 为了实现其效果,使用HTTP content - type header的链接资源。</p>
    </div>
  </dd>
  <dt>
    坐标 [只有html4支持](过时的,因为HTML5){{htmlattrdef("coords")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    <span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">对于使用对象的形状,</span><span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">这个属性使用逗号分隔的数字列表来定义对象在页面上的坐标。</span></dd>
  <dt>
    <b>绑定的字段</b>(<b>DATAFLD</b>)(不规范的){{htmlattrdef("datafld")}} {{Non-standard_inline}}</dt>
  <dd>
    <span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">从该数据源绑定的数据对象,提供此属性指定列名。</span>
    <div class="note">
      <p><strong>使用说明: </strong>该属性不规范,<strong>不应被使用</strong>. <font style="color: rgb(93, 86, 54); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);"><font>为了实现其效果,</font></font>使用脚本和一个机制如<a href="https://developer.mozilla.org/en-US/docs/nsIXMLHttpRequest" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);" title="XMLHttpRequest的"><font><font>XMLHttpRequest</font></font></a>来填充页面动态</p>
    </div>
    <table class="fullwidth-table">
      <tbody>
        <tr>
          <td rowspan="2">支持</td>
          <td>Gecko</td>
          <td>Presto</td>
          <td>WebKit</td>
          <td>Trident</td>
        </tr>
        <tr>
          <td>不支持</td>
          <td>不支持</td>
          <td>不支持</td>
          <td>IE4, IE5, IE6, IE7 ( IE8移除)</td>
        </tr>
        <tr>
          <td><span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">规范性文件</span></td>
          <td colspan="4"><a class="external" href="http://msdn.microsoft.com/en-us/library/ms533703%28VS.85%29.aspx">微软的数据绑定: 绑定的字段的属性 (MSDN)</a>&nbsp;&nbsp;</td>
        </tr>
      </tbody>
    </table>
  </dd>
  <dt>
    数据源(不规范的){{htmlattrdef("datasrc")}} {{Non-standard_inline}}</dt>
  <dd>
    <p>这个属性表示数据源对象的ID,供应的数据绑定到该元素。</p>
  </dd>
  <dd>
    <div class="note">
      <p><strong>使用说明: </strong>该属性不规范,<strong>不应被使用</strong>。<font style="color: rgb(93, 86, 54); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);"><font>为了实现其效果,</font></font>使用脚本和一个机制如<a href="https://developer.mozilla.org/en-US/docs/nsIXMLHttpRequest" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);" title="XMLHttpRequest的"><font><font>XMLHttpRequest</font></font></a>来填充页面动态</p>
    </div>
    <table class="fullwidth-table">
      <tbody>
        <tr>
          <td rowspan="2">支持</td>
          <td>Gecko</td>
          <td>Presto</td>
          <td>WebKit</td>
          <td>Trident</td>
        </tr>
        <tr>
          <td>不支持</td>
          <td>不支持</td>
          <td>不支持</td>
          <td>IE4, IE5, IE6, IE7 (IE8移除)</td>
        </tr>
        <tr>
          <td><span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">规范性文件</span></td>
          <td colspan="4"><a class="external" href="http://msdn.microsoft.com/en-us/library/ms533709(VS.85).aspx" title="http://msdn.microsoft.com/en-us/library/ms533709(VS.85).aspx">微软的数据绑定: 数据源属性 (MSDN)</a></td>
        </tr>
      </tbody>
    </table>
  </dd>
  <dt>
    下载{{htmlattrdef("download")}} {{HTMLVersionInline(5)}}</dt>
  <dd>
    <font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">此属性,如果存在,表明笔者拟用于下载资源的超级链接。</font><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">如果属性有一个值,浏览器应该解释,作为默认的文件名,笔者建议使用本地文件系统中的资源标记。</font><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">允许值没有任何限制,但你应该考虑大多数文件系统都用什么标点符号,在文件名支持方面的局限性,以及浏览器都可能调整相应的文件名。</font><br />
    <div class="note">
      <p><strong>注意事项:</strong></p>
      <ul>
        <li style="line-height: 1.5em;"><font><font>您可以使用此</font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>数据</font></font></code><font><font>,</font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>BLOB:</font></font></code><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>文件系统:</font></font></code><font><font>URLs,让用户</font></font><font><font>很容易地去</font></font><font><font>下载编程生成的内容。</font></font></li>
        <li style="line-height: 1.5em;"><font><font>如果HTTP头</font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>的Content-Disposition:</font></font></code><font><font>存在,并且给出了一个不同的文件名 和这个属性相比,HTTP头优先于此属性。</font></font></li>
        <li style="line-height: 1.5em;"><font><font>如果这个属性存在</font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>Content-Disposition:</font></font></code><font><font>被设置为</font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>内联</font></font></code><font><font>,火狐优先</font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>考虑Content-Disposition</font></font></code><font><font>,像文件名​​的情况下,而Chrome<span class="Apple-converted-space">&nbsp;</span></font></font><code style="font-style: normal; font-weight: inherit; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace;"><font><font>下载</font></font></code><font><font>属性</font><font>优先</font><font>。</font></font></li>
        <li>这个属性在 <a href="/en-US/docs/Firefox_20_for_developers" title="/en-US/docs/Firefox_20_for_developers">Firefox 20</a> 只授予相同来源的资源的链接。</li>
      </ul>
    </div>
  </dd>
  <dt>
    链接{{htmlattrdef("href")}}</dt>
  <dd>
    <p>这是一个必需属性为锚定义一个超文本链接来源<font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font>。</font><font>这表示链接目标的URL或URL片段。</font><font>URL片段是由一个hash符号(#),它指定一个内部目标</font><font>在当前文档中的</font><font>位置(</font></font><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes#attr-id" style="color: rgb(102, 153, 204); text-decoration: none; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" title="全局属性#ATTR-ID"><font><font>ID</font></font></a><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font>)</font><font>开头的名字</font><font>。URL</font><font>不限于网页(HTTP)的文件。</font><font>URL可能使用浏览器所支持的任何协议。</font><font>例如,</font></font><code style="font-style: normal; font-weight: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font><font>文件</font></font></code><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font>,</font></font><code style="font-style: normal; font-weight: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(51, 51, 51); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font><font>FTP</font></font></code><font style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><font>,</font></font>大多数用户代理mailto工作。</p>
  </dd>
  <dd>
    <div class="note">
      <p><strong>注意事项:</strong> <font style="color: rgb(93, 86, 54); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);"><font>您可以使用“顶级”的特殊片段,以创建一个链接返回到页面顶部;为例如</font></font><code style="font-style: normal; font-weight: normal; font-variant: normal; font-size: 14px; line-height: normal; font-family: 'Courier New', 'Andale Mono', monospace; color: rgb(93, 86, 54); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);"><font><font>&lt;a href="#top"&gt;返回顶部&lt;/ a&gt;的</font></font></code><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#scroll-to-fragid" lang="en" style="color: rgb(102, 153, 204); text-decoration: none; padding-right: 16px; background-image: url(https://developer.cdn.mozilla.net/media/img/wiki/icons/link_external.png); background-color: rgb(250, 249, 226); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-position: 99% 40%; background-repeat: no-repeat no-repeat;" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#滚动到fragid的"><font><font>这种行为在HTML5上被指定</font></font></a><font style="color: rgb(93, 86, 54); font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', Lucida, Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(250, 249, 226);"><font>。</font></font></p>
    </div>
  </dd>
  <dt>
    {{htmlattrdef("hreflang")}}</dt>
  <dd>
    This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by <a class="external" href="http://www.ietf.org/rfc/bcp/bcp47.txt" title="http://www.ietf.org/rfc/bcp/bcp47.txt">BCP47</a> for HTML5 and by <a class="external" href="http://www.ietf.org/rfc/rfc1766.txt" title="http://www.ietf.org/rfc/rfc1766.txt">RFC1766</a> for HTML4. Use this attribute only if the {{htmlattrxref("href", "a")}} attribute is present.</dd>
  <dt>
    {{htmlattrdef("media")}} {{HTMLVersionInline(5)}}</dt>
  <dd>
    This attribute specifies the media which the linked resource applies to. Its value must be a <a href="/en-US/docs/CSS/Media_queries" title="CSS/Media queries">media query</a>. This attribute is mainly useful when linking to external stylesheets by allowing the user agent to pick the best adapted one for the device it runs on.<br />
    <div class="note">
      <p><strong>Usage note:</strong></p>
      <ul>
        <li>In HTML 4, only simple white-space-separated list of media description literals, i.e. <a href="/en-US/docs/CSS/@media" title="https://developer.mozilla.org/en-US/docs/CSS/@media">media types and groups</a>, where defined and allowed as values for this attribute, like <code>print</code>, <code>screen</code>, <code>aural</code>, <code>braille</code>, ... HTML 5 extended this to any kind of <a href="/en-US/docs/CSS/Media_queries" title="CSS/Media queries">media queries</a>, which are a superset of the allowed values of HTML 4.</li>
        <li>Browsers not supporting the <a href="/en-US/docs/CSS/Media_queries" title="CSS/Media queries">CSS3 Media Queries</a> won't necessarilly recognize the adequate link; do not forget to set fallback links, the restricted set of media queries defined in HTML 4.</li>
      </ul>
    </div>
  </dd>
  <dt>
    {{htmlattrdef("methods")}} {{Non-standard_inline}}</dt>
  <dd>
    The value of this attribute provides information about the functions that might be performed on an object. The values generally are given by the HTTP protocol when it is used, but it might (for similar reasons as for the title attribute) be useful to include advisory information in advance in the link. For example, the browser might choose a different rendering of a link as a function of the methods specified; something that is searchable might get a different icon, or an outside link might render with an indication of leaving the current site. This attribute is not well understood nor supported, even by the defining browser, Internet Explorer 4. <a class="external" href="http://msdn.microsoft.com/en-us/library/ms534168(VS.85).aspx">Methods Property (MSDN)</a></dd>
  <dt>
    {{htmlattrdef("name")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    This attribute is required in an anchor defining a target location within a page. A value for <strong>name</strong> is similar to a value for the <strong>id</strong> core attribute and should be an alphanumeric identifier unique to the document. Under the HTML 4.01 specification, <strong>id</strong> and <strong>name</strong> both can be used with the &lt;a&gt; element as long as they have identical values.
    <div class="note">
      <p><strong>Usage note:</strong> This attribute is obsolete in HTML5, use <a href="/en-US/docs/HTML/Global_attributes#attr-id" title="HTML/Global attributes#id">global attribute <strong>id</strong></a> instead.</p>
    </div>
  </dd>
  <dt>
    {{htmlattrdef("ping")}} {{HTMLVersionInline(5)}}</dt>
  <dd>
    The support for "ping" was disabled starting with Firefox 3 beta 3. {{Bug(415168)}}</dd>
  <dt>
    {{htmlattrdef("rel")}}</dt>
  <dd>
    For anchors containing the <strong>href</strong> attribute, this attribute specifies the relationship of the target object to the link object. The value is a space-separated list of relationship values. The values and their semantics will be registered by some authority that might have meaning to the document author. The default relationship, if no other is given, is void. Use this attribute only if the <strong>href</strong> attribute is present.</dd>
  <dt>
    {{htmlattrdef("rev")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    This attribute specifies a reverse link, the inverse relationship of the <strong>rel</strong> attribute. It is useful for indicating where an object came from, such as the author of a document.</dd>
</dl>
<div class="note">
  <em>Note</em>: It is advisable to use the <strong>usemap</strong> attribute for the {{HTMLElement("img")}} element and the associated {{HTMLElement("map")}} element to define hotspots instead of the <strong>shape</strong> attribute.</div>
<dl>
  <dt>
    {{htmlattrdef("shape")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline","HTML5")}}</dt>
  <dd>
    This attribute is used to define a selectable region for hypertext source links associated with a figure to create an image map. The values for the attribute are <code>circle</code>, <code>default</code>, <code>polygon</code>, and <code>rect</code>. The format of the <strong>coords</strong> attribute depends on the value of shape. For <code>circle</code>, the value is <code>x,y,r</code> where <code>x</code> and <code>y</code> are the pixel coordinates for the center of the circle and <code>r</code> is the radius value in pixels. For <code>rect</code>, the <strong>coords</strong> attribute should be <code>x,y,w,h</code>. The <code>x,y</code> values define the upper-left-hand corner of the rectangle, while <code>w</code> and <code>h</code> define the width and height respectively. A value of <code>polygon</code> for <strong>shape</strong> requires <code>x1,y1,x2,y2,...</code> values for <strong>coords</strong>. Each of the <code>x,y</code> pairs defines a point in the polygon, with successive points being joined by straight lines and the last point joined to the first. The value <code>default</code> for shape requires that the entire enclosed area, typically an image, be used.</dd>
  <dt>
    {{htmlattrdef("target")}}</dt>
  <dd>
    This attribute specifies where to display the linked resource. In HTML4, this is the name of, or a keyword for, a frame. In HTML5, it is a name of, or keyword for, a <em>browsing context</em> (for example, tab, window, or inline frame). The following keywords have special meanings:
    <ul>
      <li><code>_self</code>: Load the response into the same HTML4 frame (or HTML5 browsing context) as the current one. This value is the default if the attribute is not specified.</li>
      <li><code>_blank</code>: Load the response into a new unnamed HTML4 window or HTML5 browsing context.</li>
      <li><code>_parent</code>:&nbsp;Load the response into the HTML4 frameset parent of the current frame or HTML5 parent browsing context of the current one. If there is no parent, this option behaves the same way as <code>_self</code>.</li>
      <li><code>_top</code>: In HTML4: Load the response into the full, original window, canceling all other frames. In HTML5: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as <code>_self</code>.</li>
    </ul>
    Use this attribute only if the <strong>href</strong> attribute is present.</dd>
  <dt>
    {{htmlattrdef("type")}}</dt>
  <dd>
    This attribute specifies the media type in the form of a MIME type for the link target. Generally, this is provided strictly as advisory information; however, in the future a browser might add a small icon for multimedia types. For example, a browser might add a small speaker icon when type is set to audio/wav. For a complete list of recognized MIME types, see <a class="linkification-ext external" href="http://www.w3.org/TR/html4/references.html#ref-MIMETYPES" title="Linkification: http://www.w3.org/TR/html4/references.html#ref-MIMETYPES">http://www.w3.org/TR/html4/references.html#ref-MIMETYPES</a>. Use this attribute only if the <strong>href</strong> attribute is present.</dd>
  <dt>
    {{htmlattrdef("urn")}} {{Non-standard_inline}}</dt>
  <dd>
    This supposedly Microsoft-supported attribute relates a uniform resource name (URN) with the link. While it is based on standards work years back, the meaning of URNs is still not well defined, so this attribute is meaningless. <a class="external" href="http://msdn.microsoft.com/en-us/library/ms534710(VS.85).aspx">urn Property (MSDN)</a></dd>
</dl>
<h2 id="Example">Example</h2>
<pre class="brush: xml">
&lt;!-- anchor linking to external file --&gt;
&lt;a href="<a class="linkification-ext" href="http://www.mozilla.com/" title="Linkification: http://www.mozilla.com/">http://www.mozilla.com/</a>"&gt;
External Link
&lt;/a&gt;
</pre>
<h3 id="Result" name="Result">Result</h3>
<!-- anchor linking to external file -->
<p><a class="external" href="http://www.mozilla.com/">External Link</a></p>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-a-element', '&lt;a&gt;')}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', 'the-a-element.html#the-a-element', '&lt;a&gt;')}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML4.01', 'struct/links.html#h-12.2', '&lt;a&gt;')}}</td>
      <td>{{Spec2('HTML4.01')}}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoDesktop("1.0")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
      <tr>
        <td><code>href="#top"</code></td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoDesktop("10.0")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
      <tr>
        <td>{{htmlattrxref("download","a")}}</td>
        <td>14</td>
        <td>{{CompatGeckoDesktop("20.0")}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoMobile("1.0")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
      <tr>
        <td><code>href="#top"</code></td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoMobile("10.0")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatVersionUnknown}}</td>
      </tr>
      <tr>
        <td>{{htmlattrxref("download","a")}}</td>
        <td>{{CompatVersionUnknown}}</td>
        <td>{{CompatGeckoMobile("20.0")}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</td>
        <td>{{CompatUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="Notes">Notes</h2>
<p>The following are reserved browser key bindings for the two major browsers and should not be used as values to accesskey: a, c, e, f, g, h, v, left arrow, and right arrow.</p>
<p>HTML 3.2 defines only <strong>name</strong>, <strong>href</strong>, <strong>rel</strong>, <strong>rev</strong>, and <strong>title</strong>.</p>
<p>The <strong>target</strong> attribute is not defined in browsers that do not support frames, such as Netscape 1 generation browsers. Furthermore, target is not allowed under strict variants of <a href="/en-US/docs/XHTML" title="XHTML">XHTML</a> but is limited to frameset or transitional forms.</p>
<h3 id="JavaScript_recommendations">JavaScript recommendations</h3>
<p>It is often the case that an anchor tag is used with the <code>onclick</code> event. In order to prevent the page from refreshing, <strong>href</strong> is often set to either "#" or "javascript:void(0)". Both of these values can lead to some unexpected errors when copying links and opening links in a new tab and/or window. Be aware of this for usability reasons, and when users do use anchor tags and you prevent default behavior.</p>
<h2 id="See_also">See also</h2>
<ul>
  <li>Other elements conveying <a href="/en-US/docs/HTML/Text_level_semantics_conveying_elements" title="HTML/Text level semantics conveying elements">text-level semantics</a>: {{HTMLElement("abbr")}}, {{HTMLElement("em")}}, {{HTMLElement("strong")}}, {{HTMLElement("small")}}, {{HTMLElement("cite")}}, {{HTMLElement("q")}}, {{HTMLElement("dfn")}}, {{HTMLElement("time")}}, {{HTMLElement("code")}}, {{HTMLElement("var")}}, {{HTMLElement("samp")}}, {{HTMLElement("kbd")}}, {{HTMLElement("sub")}}, {{HTMLElement("sup")}}, {{HTMLElement("b")}}, {{HTMLElement("i")}}, {{HTMLElement("mark")}}, {{HTMLElement("ruby")}}, {{HTMLElement("rp")}}, {{HTMLElement("rt")}}, {{HTMLElement("bdo")}}, {{HTMLElement("span")}}, {{HTMLElement("br")}}, {{HTMLElement("wbr")}}.</li>
</ul>
<div>
  {{HTML:Element_Navigation}}</div>
Revert to this revision