谷歌浏览器使用错误的Favicon大小 [英] Google Chrome Uses Wrong Size of Favicon

查看:532
本文介绍了谷歌浏览器使用错误的Favicon大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用'Icon Composer'在Mac上创建ICO文件时,它允许指定5张图像(16x16,24x24,32x32,48x48,256x256)。如果我指定16x16和32x32谷歌浏览器(Mac OS X),则使用32x32图像作为标签旁边和收藏夹(其大小调整为16x16)下名称旁边的图标。这导致图标看起来模糊。

When I create a a ICO file on the Mac using 'Icon Composer' it allows specifying five images (16x16, 24x24, 32x32, 48x48, 256x256). If I specify a 16x16 and 32x32 Google Chrome (Mac OS X) use the 32x32 image as the icon that appears next to the name on the tabs and under the favourites (it is resized to 16x16). This causes the icon to look blurry.

我是否正确创建了我的favicon.ico?我是否需要做其他事情来告诉浏览器使用16x16图像?我目前有:

Am I creating my favicon.ico correctly? Do I need to do anything else to tell the browser to use the 16x16 image? I currently have:

<head>
  <link rel="shortcut icon" href="/favicon.ico" />
</head>


推荐答案

为了在Chrome中正常使用,设置 尺寸 为您可用的最大图标大小 $ b

To get this to work correctly in Chrome, set sizes to the largest icon size you have available:

<link rel="shortcut icon" href="favicon.ico" sizes="256x256">

我在 Visual Studio Image Library ,其中包括16x16,32x32,48x48和256x256的大小。它正确地呈现浏览器标题栏中的16x16大小,任务栏中的32x32大小以及Windows 7桌面上适当的大小(可以变化)。

I tested it with icons in the Visual Studio Image Library, which include sizes of 16x16, 32x32, 48x48, and 256x256. It correctly renders the 16x16 size in the browser title bar, the 32x32 size in the taskbar, and the appropriate size (which can vary) on the Windows 7 desktop.

While我发现了很多关于为多个尺寸中的每一个尺寸列出链接元素,或者在一个链接中列出多个尺寸的建议。元素,使用最大的可用尺寸是我能够获得所有适当尺寸正确渲染图标的唯一方法。看起来,Chrome会从一个过大的图标中缩小向下,方法是找到合适的较小尺寸(如果可用),但是通过缩小尺寸来缩放尺寸 up 。因此,必须将尺寸属性设置为最大可用尺寸。

While I found a lot of advice about listing a link element for each of multiple sizes, or listing multiple sizes in one link element, using the largest available size was the only way I was able to get the favicon to render correctly in all appropriate sizes. It appears that Chrome scales down from a too-large favicon by finding appropriate smaller sizes, if available, but scales up by blowing up the small size it already has. So the sizes attribute has to be set to the largest available size.

将尺寸设置为256x256不会似乎在其他浏览器中导致问题。 IE,Firefox和Safari都按预期使用16x16大小。

Setting the size to 256x256 doesn't appear to cause problems in other browsers. IE, Firefox, and Safari all use the 16x16 size as expected.

这篇关于谷歌浏览器使用错误的Favicon大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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