<!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" />
<link
rel="stylesheet"
href="https://at.alicdn.com/t/c/font_4097141_hvuc5l7j4y4.css"
/>
<title>Document</title>
<style>
body {
display: flex;
justify-content: center;
}
.cart {
width: 50px;
position: relative;
z-index: 600;
}
.myIcon {
font-size: 24px;
cursor: pointer;
}
.cart:hover .layer {
opacity: 1;
transform: none;
}
.layer {
opacity: 0;
transition: all 0.4s 0.2s;
transform: translateY(-200px) scale(1, 0);
width: 400px;
height: 400px;
position: absolute;
top: 50px;
left: 0;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
background: #fff;
border-radius: 4px;
padding-top: 10px;
}
</style>
</head>
<body>
<div class="cart">
<i class="iconfont icon-gouwuche myIcon"></i>
<div class="layer">应该是个购物车列表</div>
</div>
</body>
</html>
CSS-鼠标悬浮,控制底部弹窗显示隐藏
于 2023-05-31 16:28:30 首次发布