<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>背景图颜色鼠标移入换色</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
background-image: url("./12.jpg");
height: 100vh;
background-size: cover; /* 确保图片覆盖整个元素 */
background-position: center; /* 将图片居中显示 */
min-height: 100vh; /* 确保至少为视口高度 */
}
.modal{
position: fixed;
width: 100%;
height: 100%;
top: 0;
right: 0;
transition: 2s;
border-left: 1px solid #333;
/* 背景虚化 */
backdrop-filter: grayscale(1);
}
body:hover .modal {
height: 0;
/*width: 0;*/
}
</style>
</head>
<body>
<div class="modal">
</div>
</body>
</html>