Home  >  Article  >  Web Front-end  >  HTML5 对各个标签的定义与规定:link

HTML5 对各个标签的定义与规定:link

WBOY
WBOYOriginal
2016-05-17 09:10:091611browse
    所有全局属性
    href
    rel
    media
    hreflang
    type
    sizes
    title(title属性对于link标签有特殊的含义)
    alternate:设置替换文档
    archives:历史归档
    author:文档作者
    first:与当前文档同系列的第一个文档。
    help:帮助文档
    icon:文档图标
    index:当前文档的内容表格或链接清单。
    last:与当前文档同系列的最后一个文档。
    license:当前文档的版权license
    next:与当前文档同系列的下一个文档。
    pingback:显示pingback当前文档的,pingback服务器地址。
    prefetch:预加载资源
    prev:与当前文档同系列的上一个文档。
    search:相关的搜索页面
    stylesheet:外部css样式文档
    sidebar:侧边栏设置
    tag:标签
    up:当前文档的上下文文档

属于meta信息。
放在head中,或者head的子元素noscript中。
为空元素。
拥有属性
DOM 接口:

代码: 全选 运行
    interface HTMLLinkElement : HTMLElement {<br>               attribute boolean disabled;<br>               attribute DOMString href;<br>               attribute DOMString rel;<br>      readonly attribute DOMTokenList relList;<br>               attribute DOMString media;<br>               attribute DOMString hreflang;<br>               attribute DOMString type;<br>      [PutForwards=value] readonly attribute DOMSettableTokenList sizes;<br>    };<br>    HTMLLinkElement implements LinkStyle;

link标签用途是设置文档的外部资源。
rel和href属性必须设置,其中href属性必须是一个有效的URL。
其中rel可设置成以下值:

link标签可以建立两种形式的链接,一种是外部资源,另一种是超级连接,例如rel设置成stylesheet是载入外部css样式文档,而设置成first就是意味着告诉浏览器该文档所处系列的第一个文档的超级链接。
一个link标签可以同时设置多个链接(甚至可以包含一些外部资源形式的和一些超级链接形式的),可设置的链接数量取决于link标签的rel属性的设置。

link标签执行过程:
1、如果href值为空,则停止解析此标签。
2、如果资源的URL属性是相对的,则根据相对此文件计算绝对URL值。
3、如果失败,停止解析。
4、根据绝对URL载入资源。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn