Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a few static pages that are just pure HTML, that we display when the server goes down.

(我有几个静态页面只是纯HTML,我们在服务器出现故障时显示。)

How can I put a favicon that I made (it's 16x16px and it's sitting in the same directory as the HTML file; it's called favicon.ico) as the "tab" icon as it were?

(我如何将我制作的图标(它是16x16px并且它与HTML文件位于同一目录中;它称为favicon.ico)作为“标签”图标?)

I have read up on Wikipedia and looked at a few tutorials and have implemented the following:

(我已经阅读了维基百科并查看了一些教程并实现了以下内容:)

<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>

But it still doesn't want to work.

(但它仍然不想工作。)

I am using Chrome to test the sites.

(我正在使用Chrome来测试这些网站。)

According to Wikipedia .ico is the best picture format that runs on all browser types.

(根据维基百科.ico是所有浏览器类型上运行的最佳图片格式。)

Update (更新)

I could not get this to work locally although the code checks out it will only really work properly once the server started serving the site.

(虽然代码检查它只能在服务器开始为站点提供服务后才能正常工作,但我无法让它在本地工作。)

Just try pushing it up to the server and refresh your cache and it should work fine.

(只需尝试将其推送到服务器并刷新缓存,它应该可以正常工作。)

  ask by TheLegend translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
341 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can make a 16x16 .png and then use one of the following snippets between the <head> tags of your static HTML documents:

(您可以制作16x16 .png,然后在静态HTML文档的<head>标记之间使用以下代码段之一:)

<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<link rel="shortcut icon" type="image/png" href="http://example.com/favicon.png"/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...