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

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

HTML <link>标签


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

定义与用法

This element defines the relationship between two linked documents.
这个元素可以用来定义两个相互连结着的文档


在HTML和XHTML中的区别

In HTML the <link> tag has no end tag.
在HTML中<link>标签没有关闭标签

In XHTML the <link> tag must be properly closed.
在XHTML 中的<link>标签必须合理的关闭


提示与注意点

Note: The link element is an empty element, it contains attributes only.
注意:link元素为空元素,它只包含属性

Note:  This element goes only in the head section, but it can appear any number of times.
注意:这个元素只可以放在head区域,但它可以重复出现。


实例

How to use the <link> tag to link to an external style sheet:

<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
</head>



可选属性

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)

属性名 描述 DTD
charset charset Defines the character encoding of the target URL. Default value is "ISO-8859-1"
定义目标URL的字符编码。默认值为"ISO-8859-1"
STF
href URL The target URL of the resource
资源地址
STF
hreflang language_code Defines the base language of the target URL
定义目标URL的基本语言
STF
media all
braille
print
projection
screen
speech
Specifies on what device the document will be displayed
指定文档可在什么设备上显示
STF
rel alternate
appendix
bookmark
chapter
contents
copyright
glossary
help
home
index
next
prev
section
start
stylesheet
subsection
Defines the relationship between the current document and the targeted document
定义目标文档和当前文档间的关系
STF
rev alternate
appendix
bookmark
chapter
contents
copyright
glossary
help
home
index
next
prev
section
start
stylesheet
subsection
Defines the relationship between the targeted document and the current document
定义目标文档和当前文档间的关系
STF
target _blank
_self
_top
_parent
Where to open the target URL.
以什么方式打开目标URL
  • _blank - 在新窗口打开目标URL
  • _self - 自身窗口或是框架中打开目标URL
  • _parent - 在父级框架中打开
  • _top - 在窗口的主体打开
TF
type MIME_type like:
text/css
text/javascript
image/gif
Specifies the MIME type of the target URL
指定目标URL的MIME类型
STF

标准属性

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

For a full description, go to Standard Attributes.
查看完整的属性

事件属性

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

For a full description, go to Event Attributes.
查看完整的属性


尝试与演示

Link to an external style sheet
How to use the <link> tag to link to an external style sheet.
怎样使用<link>标签将外部样式表导入

评论 (0) All

登陆 | 还没注册?