【问题标题】:how to add an image to the website's title in html如何在html中将图像添加到网站的标题
【发布时间】:2018-08-23 05:21:15
【问题描述】:
<head>
  <title><!--i want to add a picture into the title--></title>
</head>

请帮助我,我正在创建一个仅使用 html 的网站。我想知道如何在浏览器中显示的标题中添加图片

【问题讨论】:

标签: html image web title


【解决方案1】:

Title 用于将页面标题显示为文本

您应该使用下面的应答器来显示一个名为 logo.pngicon,例如:

<link rel="icon" type="image/png" href="logo.png" />

【讨论】:

    【解决方案2】:

    您实际上需要向网站添加网站图标。

    <link rel="icon">
    Simply add the following code to the <head> element:
    
    <link rel="icon" href="http://example.com/favicon.png">
    

    【讨论】:

      【解决方案3】:

      您要添加的实际上是一个名为 favicon。这是您想在网站标题旁边添加的小图像。

      有关网站图标的更多信息,请参阅本文:https://www.abeautifulsite.net/what-are-favicons

      需要考虑的一些事情(摘自文章)

      网站图标最常见的尺寸是:

      • 32x32
      • 48x48
      • 64x64 -128x128

      您可以使用favicon generator 将您的图片转换为正确的格式并下载。

      下载您的网站图标并将其放置在您的 html 网站目录中后,将以下代码插入您的脑海中。

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

      【讨论】:

        【解决方案4】:

        确保您使用的图标文件的大小与@Joshua 所述相同。插入以下代码。

        &lt;link rel="icon" href="....logo.ico?v=2" /&gt;

        您需要添加 ?v=2 查询字符串来强制刷新。否则你可能会遇到缓存问题。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-07-08
          • 2011-03-03
          • 1970-01-01
          • 1970-01-01
          • 2016-12-08
          • 2012-04-14
          相关资源
          最近更新 更多