fav图标在html5 Boilerplate中不起作用 [英] fav icon does not work in html5 Boilerplate

查看:112
本文介绍了fav图标在html5 Boilerplate中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

html5 Boilerplate中的收藏夹图标不起作用(不显示)

the fav icon in html5 Boilerplate doesn't work (doesn't show up)

我在localhost和服务器上都尝试过,但是在两种情况下都没有用. 是什么让它起作用.?

I have tried it on localhost and also on a server but in both the cases it didn't worked. Whats the to make it work .?

推荐答案

HTML5 Boilerplate默认情况下不使用link元素作为图标.而是依靠浏览器在根目录中找到favicon.ico或apple-touch-icon.png.

HTML5 Boilerplate doesn't use link elements for icons by default. Instead, it relies on the browser finding either favicon.ico or apple-touch-icon.png in the root directory.

如果将HTML5 Boilerplate放置在子目录中(无论是在localhost中还是在服务器上),则不会显示任何图标,或者将在服务器的根目录中显示一个现有的图标.快速解决方案是在index.html的<head>部分中添加以下代码行:

If you put HTML5 Boilerplate in a sub-directory, whether in localhost or on a server, either no favicon will appear or an existing favicon in the server's root directory will appear. A quick fix for this is to add this line of code in the <head> section of index.html :

<link rel="icon" type="image/png" href="apple-touch-icon.png">

更好的做法是创建一个16x16 PNG图像(例如favicon.png),而不是使用57x57 apple-touch-icon.png,因为它会被调整大小,因此会失去清晰度.

Even better would be to create a 16x16 PNG image (e.g. favicon.png) instead of using the 57x57 apple-touch-icon.png, which gets resized and therefore loses clarity.

请参见图标和触摸图标部分. rel ="noreferrer">用户指南以获取更多详细信息.

See the Favicons and Touch Icons section of the user guide for more details.

这篇关于fav图标在html5 Boilerplate中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆