gpt4 book ai didi

html - 最小可行图标代码

转载 作者:技术小花猫 更新时间:2023-10-29 12:15:07 26 4
gpt4 key购买 nike

我很困惑让网站图标在大多数手机和浏览器上工作的最简单方法是什么。

1) Some sites建议使用就够了:

<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-180x180.png">

这将适用于 iOS 8,Android、BlackBerry、Windows 等应该也能使用。

2) Other sites坚持每个可能的图标必须被明确指定:

<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/favicon-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<meta name="msapplication-TileColor" content="#000000">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">

3) This answer说你只需要:

<!-- For IE 9 and below. ICO should be 32x32 pixels in size -->
<!--[if IE]><link rel="shortcut icon" href="path/to/favicon.ico"><![endif]-->

<!-- Touch Icons - iOS and Android 2.1+ 180x180 pixels in size. -->
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">

<!-- Firefox, Chrome, Safari, IE 11+ and Opera. 196x196 pixels in size. -->
<link rel="icon" href="path/to/favicon.png">

以上哪项将以最少的工作量涵盖最多的浏览器/手机?

最佳答案

解决方案 3 中的代码正确但已过时。 Precomposed Touch icons were deprecated in iOS 7Android Chrome does not support 196x196 icons anymore, but 192x192 ( it really won't use anything above 192x192 ;完全披露:我是这篇文章的作者)。

所以:

<!-- For IE 9 and below. ICO should be 32x32 pixels in size -->
<!--[if IE]><link rel="shortcut icon" href="/path/to/favicon.ico"><![endif]-->

<!-- Touch Icons - iOS and Android 2.1+ 180x180 pixels in size. -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png">

<!-- Firefox, Chrome, Safari, IE 11+ and Opera. 192x192 pixels in size. -->
<link rel="icon" href="/path/to/favicon.png">

如果您可以将 favicon.ico 放在网站的根目录中,您甚至可以跳过它的声明,因为 IE 按照惯例查找 /favicon.ico

关于html - 最小可行图标代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27612244/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com