有两种方式设置:
1.
<link rel="icon" type="image/x-icon" href="..." />
2.
<link rel="shortcut icon" type="image/x-icon" href="..." />
两种方式的区别为:第一种用于希望为浏览器提供另外一种备用的图像比如gif动态图等,而第二种是大多数遵守标准的浏览器所能识别的。一般建议两个都写,如下:
<!Doctype html>
<html>
<head>
<meta http-equiv="author" content="chengxi" />
<meta http-equiv="keywords" content="icon,style,html5" />
<title设置icon图标</title>
<link rel="shortcut icon" type="image/x-icon" href=""http://c.csdnimg.cn/public/favicon.ico" />
<link rel-"icon" type="image/x-icon" href=""http://c.csdnimg.cn/public/favicon.ico" />
</head>
<body>
<!--body content-->
</body>
</html>