<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.w{
width: 400px;
height: 400px;
margin: 30px auto;
border: 1px solid red;
position: relative;
}
.box {
position: absolute;
margin: 30px auto;
left: 50px;
height: 0;
opacity: 0;
overflow: hidden;
border-left: 10px solid green;
background-color: red;
transition: all 1s;
}
.w:hover .box{
height: 200px;
opacity: 1;
}
</style>
</head>
<body>
<div class="w">
<div class="box"></div>
</div>
</body>
</html>
CSS 利用过渡属性实现线条拉伸
最新推荐文章于 2024-06-06 11:24:57 发布