html元素之link

参考:https://www.w3school.com.cn/tags/tag_link.asp

介绍

link元素,定义浏览器文档与外部资源的关系。
此元素只能存在于 head 部分,不过它可出现任何次数。

最主要的作用,就是引入外部css文档。

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

但还存在其他用法:

<link type="application/rss+xml" rel="alternate" href="https://www.cnblogs.com/shihaiying/rss">
<link type="application/rsd+xml" rel="EditURI" href="https://www.cnblogs.com/shihaiying/rsd.xml">
<link type="application/wlwmanifest+xml" rel="wlwmanifest" href="https://www.cnblogs.com/shihaiying/wlwmanifest.xml">
<link id="favicon" rel="shortcut icon" href="//common.cnblogs.com/favicon.svg" type="image/svg+xml">

属性

rel

规定当前文档与被链接文档之间的关系。

alternate
author
help
icon
licence
next
pingback
prefetch
prev
search
sidebar
stylesheet
tag

href

规定被链接文档的位置。

type

规定被链接文档的 MIME 类型。

预加载

https://segmentfault.com/a/1190000040327772

posted @ 2022-05-10 12:41  黑白猫123  阅读(104)  评论(0编辑  收藏  举报