Html Favicon 格式 GIF 还是 ICO?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3547934/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:14:25  来源:igfitidea点击:

Favicon format GIF or ICO?

htmlfavicon

提问by Solidariti

Why use a GIF favicon? Is that for iPhone and iPad can read it?

为什么要使用 GIF 图标?是说对于 iPhone 和 iPad 都可以读取吗?

<link rel="icon" href="/favicon.gif">

采纳答案by Stephen

Browsers started supporting it. Also, ICO files are an old image file format for icons in Microsoft Windows. Since ICO is vendor specific, some choose to go with GIF.

浏览器开始支持它。此外,ICO 文件是 Microsoft Windows 中图标的旧图像文件格式。由于 ICO 是特定于供应商的,因此有些人选择使用 GIF。

Not to mention that there is an abundance of .gif editors, and few ICO editors.

更不用说有大量的 .gif 编辑器,而很少有 ICO 编辑器。

After reviewing supported formats, your best bet is to go with PNG files if you are trying to get away from ICO.

在查看支持的格式后,如果您想摆脱 ICO,最好的选择是使用 PNG 文件。

回答by Macros

A GIF can be animated although browser support for this is currently quite limited. ICO is currently the more widely supported format (including iPhone and iPad). A full list of browser compatibility can be found in this WIkipedia article.

GIF 可以是动画的,尽管目前浏览器对此的支持非常有限。ICO 是目前支持更广泛的格式(包括 iPhone 和 iPad)。可以在这篇 Wikipedia 文章中找到浏览器兼容性的完整列表。

回答by Paul Rubel

.icofiles are the most widely supported. Wikipedia has a list of which browsers support which formats.

.ico文件是最广泛支持的。维基百科列出了哪些浏览器支持哪些格式

According to that list FireFox and Opera are the only ones that support animated GIFs, and IE doesn't support GIF at all.

根据该列表,FireFox 和 Opera 是唯一支持动画 GIF 的,而 IE 根本不支持 GIF。

回答by Computerish

GIFfavicons are sometimes used so that they can be animated, but ICOs have wider browser support. If you are trying to make favicons specifically for iPhone/iPod Touch, you might want to take a look at this:

GIF有时会使用 favicons 以便它们可以被动画化,但ICOs 具有更广泛的浏览器支持。如果您正在尝试专门为 iPhone/iPod Touch 制作网站图标,您可能想看看这个:

http://iboughtamac.com/2008/01/23/making-an-iphoneipod-touch-webclips-favicon/

http://iboughtamac.com/2008/01/23/making-an-iphoneipod-touch-webclips-favicon/

回答by Christian Hujer

Whether to go for GIF, ICO, PNG, SVG or something else for your favicon depends on a number of factors.

是否为您的网站图标使用 GIF、ICO、PNG、SVG 或其他格式取决于许多因素。

The major reasons to go for ICO are:

进行 ICO 的主要原因是:

  • Format supported by the majority of browsers (i.e. Internet Explorer before 11 doesn't support anything else).
  • It's the only format of the relevant ones that stores multiple images in one, in different sizes, allowing for one file to contain the icon in various sizes such as 16x16, 24x24, 32x32, 48x48, 64x64, 72x72 and 128x128 to name the most popular icon sizes. Depending on the available space and the available sizes in the icon file, the browser may then choose a most appropriate size for a given situation without having to upscale or downscale it.
  • 大多数浏览器支持的格式(即 11 之前的 Internet Explorer 不支持其他任何格式)。
  • 它是相关格式中唯一一种将多个不同大小的图像存储在一个文件中的格式,允许一个文件包含各种大小的图标,例如 16x16、24x24、32x32、48x48、64x64、72x72 和 128x128 以命名最流行的图标大小。根据可用空间和图标文件中的可用大小,浏览器可以为给定情况选择最合适的大小,而不必放大或缩小它。

Reasons for GIF:

GIF的原因:

  • Animated GIF is the only possibility to get an animated favicon (as most browsers do not yet support SVG for favicons, and even if they do, whether they support JavaScript or SMIL animations in the case of favicons may be questionable).
  • 动画 GIF 是获得动画收藏夹图标的唯一可能性(因为大多数浏览器尚不支持收藏夹图标的 SVG,即使支持,在收藏夹图标的情况下它们是否支持 JavaScript 或 SMIL 动画可能是有问题的)。

If your icon exists in only one size and support in older versions of Internet Explorer is no concern, you might prefer PNG or GIF because of the smaller file size. However, ICO files, if stored properly, are not significantly larger than PNG files, because since Windows Vista, ICO files can store PNG. So, a corresponding ICO file would be 22 bytes bigger (6 bytes header plus 16 bytes entry).

如果您的图标只有一种尺寸,并且在旧版本的 Internet Explorer 中的支持无关紧要,您可能更喜欢 PNG 或 GIF,因为文件较小。但是,ICO 文件,如果存储得当,不会比 PNG 文件大很多,因为从 Windows Vista 开始,ICO 文件可以存储 PNG。因此,相应的 ICO 文件将大 22 个字节(6 个字节的标题加上 16 个字节的条目)。

Side-note: In the HTML that you've specified, there might be a contradiction. If the file /favicon.gifis indeed a GIF image, then the MIME-type used in the link is wrong. In that case, it should not be image/x-iconbut image/gif.

旁注:在您指定的 HTML 中,可能存在矛盾。如果文件/favicon.gif确实是 GIF 图像,则链接中使用的 MIME 类型是错误的。在那种情况下,它不应该是image/x-iconbut image/gif

The Wikipedia page contains more information on this: https://en.wikipedia.org/wiki/Favicon

维基百科页面包含更多相关信息:https: //en.wikipedia.org/wiki/Favicon

回答by Robert Greiner

  • More people have access to create gif or png files.
  • gif's can be animated
  • 更多的人可以创建 gif 或 png 文件。
  • gif 可以动画

also, beware that gif favicons do not work in all versions of IE.

另外,请注意 gif 图标在所有版本的 IE 中都不起作用。