<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>遮罩</title>
<style>
/*<!--首先确定遮罩层的大小-->*/
.ih-item{
position: relative;
width: 1220px;
height: 620px;
}
/*//首先确定遮罩层中图片的大小*/
.ih-item .img img{
position: relative;
width: 1220px;
height: 620px;
}
/*提示文字*/
.ih-item .info {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
-webkit-backface-visibility: hidden;/* 隐藏旋转元素的背面*/
backface-visibility: hidden;
background: rgba(0, 0, 0, 0.6); /*后面这个0.6是指的背景的透明度*/
opacity: 0;
-webkit-transition: all 0.35s ease-in-out; /*规定提示信息怎样出现ease-in-out以慢速度开始和结束*/
-moz-transition: all 0.35s ease-in-out;
transition: all 0.35s ease-in-out;
}
.ih-item a:hover .info {
opacity: 1; /*有opacity有0变成1*/
}
</style>
</head>
<body>
<div class="ih-item">
<a href="#">
<div class="img"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1591858206875&di=50a518724629750af9b20284632871c3&imgtype=0&src=http%3A%2F%2Fa0.att.hudong.com%2F27%2F10%2F01300000324235124757108108752.jpg" alt="img"></div>
<div class="info">
<h3>视频遮罩层</h3>
<span>
视频遮罩层视频遮罩层视频遮罩层视频遮罩层
</span>
</div>
</a>
</div>
</body>
</html>
css简单遮罩效果
最新推荐文章于 2023-09-22 15:15:55 发布