代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
height: 100vh;
background: #282c34;
display: flex;
justify-content: center;
align-items: center;
}
.btn-box {
width: 800px;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.box {
position: relative;
width: 250px;
height: 125px;
border-radius: 10px;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
color: white;
text-align: center;
user-select: none;
margin: 5px;
box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.2);
}
.box:nth-of-type(1) {
background: linear-gradient(150deg,
rgb(251, 122, 8),
rgb(240, 47, 31));
}
.box:nth-of-type(2) {
background: linear-gradient(150deg,
rgb(241, 43, 84),
rgb(237, 11, 125));
}
.box:nth-of-type(3) {
background: linear-gradient(150deg,
rgb(65, 182, 73),
rgb(125, 195, 65));
}
.box:nth-of-type(4) {
background: linear-gradient(150deg,
rgb(5, 141, 239),
rgb(22, 175, 194));
}
.box:nth-of-type(5) {
background: linear-gradient(150deg,
rgb(134, 0, 255),
rgb(103, 0, 255));
}
.box:nth-of-type(6) {
background: linear-gradient(150deg,
rgb(209, 11, 148),
rgb(113, 52, 178));
}
.ripple {
display: block;
position: absolute;
border-radius: 100%;
background: rgba(255, 255, 255, 0.5);
transform: scale(0);
}
.animation {
animation: ripple 0.5s ease-in;
}
@keyframes ripple {
100% {
transform: scale(3);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="btn-box">
<div class="box">
<span class="ripple"></span>
<p>鎏金</p>
</div>
<div class="box">
<span class="ripple"></span>
<p>魅红</p>
</div>
<div class="box">
<span class="ripple"></span>
<p>翠柳</p>
</div>
<div class="box">
<span class="ripple"></span>
<p>靛青</p>
</div>
<div class="box">
<span class="ripple"></span>
<p>惑紫</p>
</div>
<div class="box">
<span class="ripple"></span>
<p>霞彩</p>
</div>
</div>
<script>
let box = document.querySelectorAll(".box");
for (let i = 0; i < box.length; i++) {
box[i].onmouseenter = function (event) {
let ripple = box[i].querySelector(".ripple");
ripple.classList.add("animation");
ripple.style.width = this.offsetWidth + "px";
ripple.style.height = this.offsetWidth + "px";
ripple.style.top = -(this.offsetHeight - event.offsetY) + "px";
ripple.style.left = -(this.offsetWidth / 2 - event.offsetX) + "px";
setTimeout(function () {
ripple.classList.remove("animation");
}, 500)
}
}
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。