【发布时间】:2022-04-11 00:23:39
【问题描述】:
我已将此标签添加到我的 html 中的 head 标签中,当我检查代码时可以看到图像,但无法显示图标。
<link rel = "shortcut icon" type = "image" href = "{% static 'images/logo.png' %}">
我什至尝试过
<link rel = "shortcut icon" type = "image/png" href = "{% static 'images/logo.png' %}">
和
<link rel = "shortcut icon" type = "image/x-icon" href = "{% static 'images/logo.png' %}">
但是没用
我已经参考了这个链接add logo meta to html 我的代码是这样的
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel = "shortcut icon" type = "image" href = "{% static 'images/logo.png' %}">
</head>
【问题讨论】:
-
1.按 F12。 2. 在网络中查看浏览器试图找到图标的位置。 3. 查看源代码,看看渲染的 HTML 是否正确
-
如果确实是 png 则更改为
type="image/png" -
我已经尝试了你提到的所有方法,但没有成功。 @mplungjan