<!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>分类弹窗</title>
<style>
.container{
position: relative;
width: 280px;
height: 400px;
padding: 5px;
background-color: pink;
box-sizing: border-box;
}
.menu{
height: 100%;
width: 100%;
background-color: cadetblue;
}
.layer{
display: none;
position: absolute;
top: 0;
left: 280px;
width: 520px;
height: 400px;
background-color: coral;
}
// 放在最后,以便覆盖前面的样式!!
.container:hover .layer{
display: block;
}
</style>
</head>
<body>
<div class="container">
<div class="menu"></div>
<div class="layer"></div>
</div>
</body>
</html>
分类弹窗实现效果(CSS)
最新推荐文章于 2025-12-10 20:36:34 发布
这个博客展示了如何使用HTML、CSS创建一个交互式的悬浮菜单。当鼠标悬停在容器上时,一个彩色的扩展层会从菜单右侧滑出,提供更丰富的交互体验。该设计涉及CSS的定位、过渡效果以及盒模型的理解。
1170

被折叠的 条评论
为什么被折叠?



