<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> CSS效果</title>
</head>
<style>
.demo,
.mask,
.img{
width: 500px;
height: 500px;
/* border-radius: 50%; */
margin: 0 auto;
}
.demo {
display: block;
position: relative;
}
.img {
position: absolute;
top: 0;
left: 0;
background-image: url(image/1.jpg);
background-size: cover;
backgroud-position: 50% 50%;
background: red;
}
.mask {
position: absolute;
transition: all 0.5s ease-out;
}
.mask {
text-align: center;
color: rgba(0, 0, 0, 0);
}
.info {
margin-top: 50%;
}
/* .border {
border: 10px solid #FFF;
box-sizing: border-box;
} */
.demo:hover .mask {
color: rgba(225, 225, 225, 1);
}
.demo:hover .border {
}
.demo:hover .img {
background-image: url(image/2.jpeg);
}
</style>
<body>
<div class="demo">
<div class="img"></div>
<div class="mask">
<div class="info">
<h1>8.00</h1>
<p>Learn CSS Hover</p>
</div>
</div>
<!-- <div class="border"></div> -->
</div>
</body>
</html>
鼠标滑入显示 遮罩层 滑出消失 底部有内容 用的动画
最新推荐文章于 2021-09-14 18:09:15 发布