html - 图标不见了?

标签 html css

我正在使用

加载网站图标
<link rel="shortcut icon" href="../resources/img/favicon.png">

这条路径显然存在,但我没有得到任何图像

所有的时间。

我该如何解决这个问题?

最佳答案

两种可能性。

  1. 你的路径不正确
  2. 您的代码无法正常工作

(3. 你的图片拼写不正确/不存在,但我保留了这个选项,因为那样会失败,哈哈)

试试这个:

<link rel="icon" type="image/png" href="../resources/img/favicon.png">

如果上述代码不起作用,您需要修复 href 路径。 (也许将 favicon 移动到源映射并将 favicon 代码放在 index.php 内的 head 标签内)

如果您将网站图标移动到源 map :

<link rel="icon" type="image/png" href="favicon.png">

我在网上找到的一些示例代码:

<html>
<head>
  <link rel="icon" href="demo_icon.gif" type="image/gif" sizes="16x16">
</head>
<body>

<h2>Hello world!</h2>
<p>Open this page in a <a href="tryhtml5_link_sizes.htm" target="_blank">new window</a> to see the favicon.</p>
<p><b>Note:</b> The sizes attribute is not currently supported in any of the major browsers.</p>

</body>
</html>

解释: https://www.w3schools.com/tags/att_link_sizes.asp

要确保您的网站图标已加载,请按 CTRL+F5。不确定是否需要它而不是“仅”F5(页面重新加载)。

关于html - 图标不见了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48459152/

相关文章:

html - 将一个 div 中的图像与其他 div 对齐

html - CSS - 父 div 扩展到子 SVG 之外

html - Bootstrap 3字形图标在悬停时显示文本

javascript - 如何根据可用的 div 区域大小剪切长文本?

html - 在悬停时调整元素的大小以不移动其他元素

css - 想要更改 Magento go 标题部分

HTML 表格 : keep center aligned, 无论浏览器宽度如何

jquery - 如何在 input 和 label 元素中创建 mouseover 和 mouseleave 效果

html - 当视口(viewport)小于特定大小时,如何告诉 srcset 属性不加载图像

css - 通过 css 更改图标