背景:
自己做了个小网站,想在网页的右下角贴上自己的微信二维码,用以下代码就可以了。
注意,这里是放右下角了,距离和二维码的图片大小需要自己去调整。
/*二维码的名字和路径需要自己修改*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Example</title>
<style>
/* CSS 样式 */
#QRCode {
position: fixed;
bottom: 20px; /* 距离底部的距离 */
right: 20px; /* 距离右侧的距离 */
z-index: 9999; /* 可选,设置图像的层级 */
}
body {
font-family: 'Helvetica', sans-serif;
margin: 0;
padding: 0;
background: #f4f4f4;
}
</style>
</head>
<body>
<!-- 嵌入二维码图像 -->
<img id="QRCode" src="QRcode.jpg" alt="QR Code" width="100" height="100">
/*二维码的名字和路径需要自己修改*/
</body>
</html>