给页面加水印
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>水印处理</title>
<style type="text/css">
header {
height: 50px;
border-bottom: 1px solid #ddd;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
}
.water-mark {
position: fixed;
left: 0;
top: 50px;
right: 0;
bottom: 0;
z-index: 99999;
pointer-events: none;
}
</style>
</head>
<body>
<div class="water-mark">
</div>
<header>
<h3>加水印-当前时间和名字</h3>
</header>
<div class="content">
<div class="text-wrapper">
<span>这里是内容区</span>
</div>
</div>
<script typee="text/javascript">
let name = 'Kevin'
let date = '2019-11-20'
var background = "url(\"data:image/svg+xml;utf8,"+
"<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='130' width='130'>" +
"<text text-anchor='middle' transform='rotate(-20)' font-weight='bold' fill='rgba(221, 221, 221, .7)' font-size='14' >" +
"<tspan x='50' y='50'>"+ name +" </tspan>" +
"<tspan x='50' y='65'>"+ date +" </tspan>" +
"</text>"+
"</svg>\")";
let domObj = document.getElementsByClassName('water-mark')[0]
domObj.style.backgroundImage= background;
</script>
</body>
</html>