<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
*{margin: 0pxpadding: 0pxlist-style: nonetext-decoration: none}/*通配符,个人习惯*/
#btn{background: url(https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png)width: 540pxheight: 258px}
</style>
</head>
<body>
<h1>button按钮的背景是图片</h1>
<button id="btn"></button>
</body>
</html>
首先准备一个32*32 格式为 ico 的图标
方法/步骤
1
先做好一张格式为ico的图标(我就是用在线工具转换为ico格式的)
2
打开页面代码,找到<head>标签,在<head></head>标签中插入一句,
<link href="/favicon.ico" rel="shortcut icon">
请点击输入图片描述
3
ok啦,运行一下你的网页,看看是不是有图标了呢?
请点击输入图片描述
END
注意事项
图标格式一定要是ico格式的
图片路径要写正确
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)