这个问题在这里已有答案:
我正在建立一个网站,我想在浏览器的标题栏中添加一个小图标徽标。我必须放置代码?我在头前试过但没有任何反应
标题栏上的徽标称为favicon。要在您的网站中加入图标,您只需在标记内提供指向图标的链接即可。
<!DOCTYPE html>
<html>
<head>
<title>This is a title</title>
<link rel = "icon" type = "image/png" href = "/icon.png">
<!-- For apple devices -->
<link rel = "apple-touch-icon" type = "image/png" href = "/icon.png"/>
</head>
</html>
通过使用此功能,您可以在网站的标题栏中包含您的图标。您的图标的扩展名应为.png以获得更好的可见性,并将您的png转换为.ico扩展名以获得更多支持。
您不能使用任何图标库作为图标徽标浏览器,而是必须创建一个ico图像并将代码粘贴到下面
使用此代码:
<link rel="icon" href="yourimage.ico>" type="image/x-icon">
您必须将其粘贴到head标签中