如何在 HTML 页面的标题中插入徽标?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10691021/
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
How to insert logo with the title of a HTML page?
提问by Paic Ten
As stackoverflow.com has logo with it's title, how it can be done for any usual site? Which code is needed for this?
由于 stackoverflow.com 的标题带有徽标,因此如何为任何常用站点完成此操作?这需要哪个代码?
回答by MetalFrog
Are you referring to the favicon?
你指的是favicon吗?
Upload a 16x16px ico to your site, and link it in your head
section.
将 16x16px 的 ico 上传到您的网站,并将其链接到您的head
部分。
<link rel="shortcut icon" href="/favicon.ico" />
There are a multitude of sites that help you convert images into .ico format too. This is just the first one I saw on Google. http://www.favicon.cc/
有许多网站也可以帮助您将图像转换为 .ico 格式。这只是我在谷歌上看到的第一个。http://www.favicon.cc/
回答by Darius
Yes you right and I just want to make it understandable for complete beginners.
是的,你说得对,我只是想让完整的初学者理解它。
- Create favicon.ico file you want to be shown next to your url in browsers tab. You can do that online. I used http://www.prodraw.net/favicon/generator.phpit worked juts fine.
- Save generated ico file in your web site root directory /images (yourwebsite/images) under the name favicon.ico.
- Copy this tag
<link rel="shortcut icon" href="images/favicon.ico" />
and past it without any changes in between<head>
opening and</head>
closing tags. I usually place it right above<title>
tag. But that is not a rule. - Save changes in your html file and reload your browser.
- 创建您希望在浏览器选项卡中的 url 旁边显示的 favicon.ico 文件。你可以在网上这样做。我使用了http://www.prodraw.net/favicon/generator.php它工作得很好。
- 将生成的 ico 文件以 favicon.ico 的名称保存在您的网站根目录 /images (yourwebsite/images) 中。
- 复制此标签
<link rel="shortcut icon" href="images/favicon.ico" />
并粘贴它,在<head>
开始和</head>
结束标签之间没有任何更改。我通常把它放在<title>
标签正上方。但这不是规则。 - 保存 html 文件中的更改并重新加载浏览器。
回答by John Conde
It's called a favicon. They're easy to do.
回答by Brian Warshaw
It's called a favicon. It is inserted like this:
它被称为网站图标。它是这样插入的:
<link rel="shortcut icon" href="favicon.ico" />
回答by Hope4You
Put this in the <head>
section:
把它放在这个<head>
部分:
<link rel="icon" href="http://www.domain.com/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.domain.com/favicon.ico" type="image/x-icon" />
Keep the picture file named "favicon.ico". You'll have to look online to get a .ico file generator.
保留名为“favicon.ico”的图片文件。您必须在线查看才能获得 .ico 文件生成器。