【问题标题】:Is it possible to link all the icons to an external file?是否可以将所有图标链接到外部文件?
【发布时间】:2014-04-15 23:40:17
【问题描述】:

我为 ipad、iphone 和其他设备设置了不同的图标。

是否可以通过外部文件引用所有这些?还是我需要将所有这些链接粘贴到每个页面的头部?

<link rel="apple-touch-icon" href="img/apple-touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-iphone-retina-display.png">
<link rel="shortcut icon" href="img/favicon.ico">

【问题讨论】:

  • 你使用服务器端编程语言吗?
  • 不确定这意味着什么。我将它粘贴到 html 中。
  • 服务器端如何工作?

标签: html responsive-design icons


【解决方案1】:

您不必在每个页面中都声明 Apple 触摸图标。没有“外部文件”技术,但Apple defines both declarations and file naming conventions. 您可以使用约定来避免额外的 HTML 代码。

为此:

  • 删除声明 Apple 触摸图标的三个 link 标记。
  • 将您的图标放在您网站的根目录(即/)中。
  • 根据 Apple 规范重命名您的图标:apple-touch-icon-72x72.pngapple-touch-icon-114x114.png 等。

iOS 设备仍然可以找到它们。这种做法的警告说明:这对于 iOS 设备是可以的。但其他一些平台,例如 Android,也使用这些图标。而且这些平台可能无法使用 Apple 定义的约定(声明支持更广泛)。

关于图标大小的另一个说明:72x72 和 114x114 适用于 iOS 6 及更低版本。确保你定义了Apple touch icons with the right sizes

【讨论】:

    猜你喜欢
    • 2010-10-07
    • 1970-01-01
    • 2011-06-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 2020-12-17
    相关资源
    最近更新 更多