HTML元素 - a




Designates the start or destination of a hypertext link.


元素a需要指定 href 或 name 属性。

文本和图像都可包含在锚内。作为锚的图像有一个边框,该边框颜色表明该链接是否被访问过。要避免显示此边框,你可设置 img 元素的 BORDER 标签属性为 0 或者省略 BORDER 标签属性。你还可以使用样式表 CSS 来覆盖 a 和 img 元素的默认外观。

注意 当对象table包含在 a 标签内时可能工作不正常。

如果对元素 A 应用 time2 行为的话,那么该元素仅当在时间线上激活时才会变成链接。

此元素在Internet Explorer 3.0及以上版本 的 HTML 和脚本中可用。



The a element requires the href or the name property to be specified.

Both text and images can be included within an anchor. An image that is an anchor has a border whose color indicates whether the link has been visited. To prevent this border from displaying, you can set the img element's BORDER attribute to 0 or omit the BORDER attribute. You can also use Cascading Style Sheets (CSS) attributes to override the default appearance of a and img elements.

Note A table object does not function properly when contained within an a tag.

If the time2 behavior is applied to the A element, it will become a link only when it is active on the timeline.

This element is available in HTML and script as of Internet Explorer 3.0.

This element is an inline element.

This element requires a closing tag.


<!-- Link to a server. 链接到服务器 -->

<A HREF="">php100网 php100学院主页</A>

<!-- Link to a file in the same directory. 链接到同一目录的文件 -->

<A HREF="home.htm">home.htm</A>

<!-- Open a file in the window specified by TARGET. 在由 TARGET 指定的窗口中打开文件 -->

<A TARGET="viewer" HREF="sample.htm">Open in window</A>

<!-- Include an IMG element as a part of the link. 将 IMG 元素作为链接的一部分。-->

<A HREF=""><IMG SRC="../images/logo/blabla_logo01.gif">link</A>

<!-- Link to an anchor. 链接到锚。-->

<A HREF="#anchor">anchor</A>

<!-- Define an anchor. 定义一个锚 -->

<A NAME="anchor">

<!-- Invoke a JScript function 调用 JScript 函数-->

<A HREF="">link</A>