【问题标题】:Adding icon to title in Django project fails在 Django 项目中向标题添加图标失败
【发布时间】: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

标签: html css


【解决方案1】:

一切都很好。您只需要清除本地主机的缓存/cookies。

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
  • 如果您有新问题,请点击 按钮提出问题。如果有助于提供上下文,请包含指向此问题的链接。 - From Review
猜你喜欢
  • 2012-06-25
  • 1970-01-01
  • 2011-10-21
  • 1970-01-01
  • 2013-09-21
  • 2013-08-06
  • 1970-01-01
  • 1970-01-01
  • 2013-11-05
相关资源
最近更新 更多