HTML rel 属性

HTML rel 属性 

rel 属性 -- link标签中的rel属性,定义了文档与链接的关系.
  • 此属性通常出现在a,link标签中
  • 属性值

    • Alternate -- 定义交替出现的链接

    • Alternate 属性值 -- alternate是LinkTypes的一个值,网页设计者可以通过此值,设计交替出现的链接
      • 此属性值通常在,rel,rev属性中出现

      示例

      定义两种不同的样式,用户可以通过浏览器选择样式(ie不支持此属性)

      <link
      rel
      =
      "stylesheet"
      type
      =
      "text/css"
      title
      =
      "blue"
      href
      =
      "dreamdublue.css"
      />
      <link
      rel
      =
      "alternate stylesheet"
      type
      =
      "text/css"
      title
      =
      "red"
      href
      =
      "dreamdured.css"
      />
      

      可以通过http://www.dreamdu.com/feed/读取http://www.dreamdu.com/的内容

      <link
      rel
      =
      "alternate"
      type
      =
      "application/rss+xml"
      href
      =
      "http://www.dreamdu.com/feed/"
      />
      

    • Stylesheet -- 定义一个外部加载的样式表

    • link 标签 -- 当在文档中声明使用外接资源(比如CSS)时使用此标签
      • link标签是单独出现的
      • 属性
        • href -- 指定需要加载的资源(CSS文件)的地址URI
        • media -- 媒体类型,参见CSS教程
        • rel -- 指定链接类型
        • rev -- 指定链接类型
        • type -- 包含内容的类型,一般使用type="text/css"

      示例

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

    • Start -- 通知搜索引擎,文档的开始

    • start next prev 属性值 -- start next prev,全部属于LinkTypes,此值通常可以提示浏览器文章的开始,下一篇,上一篇的url
      • 此属性值通常在,rel,rev属性中出现

      示例

      <link
      rel
      =
      "start"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/"
      />
      <link
      rel
      =
      "prev"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/alternate/"
      />
      <link
      rel
      =
      "next"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/attribute_rel/"
      />
      

    • next -- 记录文档的下一页.(浏览器可以提前加载此页)

    • start next prev 属性值 -- start next prev,全部属于LinkTypes,此值通常可以提示浏览器文章的开始,下一篇,上一篇的url
      • 此属性值通常在,rel,rev属性中出现

      示例

      <link
      rel
      =
      "start"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/"
      />
      <link
      rel
      =
      "prev"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/alternate/"
      />
      <link
      rel
      =
      "next"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/attribute_rel/"
      />
      

    • Prev -- 记录文档的上一页.(定义浏览器的后退键)

    • start next prev 属性值 -- start next prev,全部属于LinkTypes,此值通常可以提示浏览器文章的开始,下一篇,上一篇的url
      • 此属性值通常在,rel,rev属性中出现

      示例

      <link
      rel
      =
      "start"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/"
      />
      <link
      rel
      =
      "prev"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/alternate/"
      />
      <link
      rel
      =
      "next"
      type
      =
      "text/html"
      href
      =
      "http://www.dreamdu.com/xhtml/attribute_rel/"
      />
      
    • Contents
    • Index -- 当前文档的索引
    • Glossary -- 词汇
    • Copyright -- 当前文档的版权
    • Chapter -- 当前文档的章节
    • Section -- 作为文档的一部分
    • Subsection -- 作为文档的一小部分
    • Appendix -- 定义文档的附加信息
    • Help -- 链接帮助信息
    • Bookmark -- 书签

rel与rev属性相同,它们都是属于LinkTypes属性.

posted @   阿K&amp;LiveCai  阅读(1742)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
点击右上角即可分享
微信分享提示