当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <a>标签

HTML
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML 属性
HTML 事件
HTML URL-encode
HTML Web服务器
HTML 摘要
HTML 实例
标签列表
标准属性
事件属性
ASCII码
特殊字符
HTTP状态消息

HTML <a>标签


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 671 ::
收藏到网摘: n/a

Definition and Usage
用法

The <a> tag defines an anchor. An anchor can be used in two ways:
<a>标签能够定义锚点,锚点的用途有两种:

  1. To create a link to another document by using the href attribute
    使用href属性来连接连到另一个文档
  2. To create a bookmark inside a document, by using the name or id attribute
    通过使用name或id属性来建立一个文档内的书签

Differences Between HTML and XHTML
它在HTML和XHTML中的区别

NONE


Tips and Notes
注意以及提示

Note: A linked page is normally displayed in the current browser window, unless you specify another target.
注意:连接到的页面一般都是在原有的窗口中显示出来,除非你指定了其它的target属性值。


Example
实例

Source Output

<p>连接到 ruanchen:
<a href="http://www.ruanchen.com">
ruanchen</a>
</p>

<p>
在新窗口中打开ruanchen:
<a href="http://www.ruanchen.com"
target="_blank">ruanchen</a>
</p>

连接到ruanchen: ruanchen

在新窗口中打开ruanchen: ruanchen



Optional Attributes
可选属性

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
DTD所允许的示意为:S=Strict[严密型], T=Transitional[过渡型], 以及 F=Frameset[框架型]

Attribute
属性
Value
Description
描述
DTD
charset character_encoding Specifies the character encoding of the target URL
指定目标URL的字符编码
STF
coords

if shape="rect" then
coords="left,top,right,bottom"

if shape="circ" then
coords="centerx,centery,radius"

if shape="poly" then
coords="x1,y1,x2,y2,..,xn,yn"

Specifies the coordinates appropriate to the shape attribute to define a region of an image for image maps
为图片指定合适的坐标范围
STF
href URL The target URL of the link
连接的URL
STF
hreflang language_code Specifies the base language of the target URL
指定目标URL所使用的基本语言
STF
name section_name Names an anchor. Use this attribute to create a bookmark in a document.
锚点的命名。使用该属性可以建立文档的书签

In future versions of XHTML the name attribute will be replaced by the id attribute!!
在XHTML中name属性将被id属性所取代

STF
rel alternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Specifies the relationship between the current document and the target URL
指定当前文档与目标URL之间的关系
STF
rev alternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Specifies the relationship between the target URL and the current document
指定目标URL与之间当前文档的关系
STF
shape rect
rectangle
circ
circle
poly
polygon
Defines the type of region to be defined for mapping in the current area tag. Used with the coords attribute.
使用coords属性为当前区域的标签指定热点类型
STF
target _blank
_parent
_self
_top

Where to open the target URL.
如何打开目标URL

  • _blank - the target URL will open in a new window
    在新窗口打开
  • _self - the target URL will open in the same frame as it was clicked
    在当前窗口(Frame)打开
  • _parent - the target URL will open in the parent frameset
    在父级框架集中打开
  • _top - the target URL will open in the full body of the window
    在当前窗口主体中打开
TF
type mime_type Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL
指定目标URL的MIME(延伸性多用途网际邮件)类型
STF

Standard Attributes
标准属性

id, class, title, style, dir, lang, xml:lang, tabindex, accesskey

For a full description, go to Standard Attributes.
查看完整描述请前往标准属性参考

Event Attributes
事件属性

onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.
查看完整的相关描述,请前往事件属性参考


Try-It-Yourself Demos
演示

Create hyperlinks
How to create hyperlinks.
建立超级连接

An image as a link
How to use an image as a link.
使用图片作为连接

Open a link in a new browser window
How to open a link in a new browser window, so that the visitor does not have to leave your Web site.
在新窗口打开连接

Link to a location on the same page
How to link to a bookmark.
连接到书签

Break out of a frame
How to break out of a frame (if your site is locked in a frame).
脱离框架

Create a mailto link
How to link to a mail message (will only work if you have mail installed).
建立邮件连接

Create a mailto link 2
Another mailto link.
另一种邮件连接

评论 (0) All

登陆 | 还没注册?