<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.box {
width: 300px;
height: 100px;
background-color: rgba(112, 76, 182, 0.4);
position: relative;
}
.box:active {
background-color:rgba(112, 76, 182, 0.6);
}
.box::after {
content: "";
width: 100%;
height: 100%;
position: absolute;
background-color: rgba(112, 76, 182, 0.4);
opacity: 0;
transition: width 1s ease-in-out, opacity
css 实现点击后水波推动效果 运用:active 和 ::after
最新推荐文章于 2024-06-21 03:03:23 发布