<!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>
.box {
position: relative;
448px;
height: 252px;
margin: 100px auto;
}
img {
100%;
height: 100%;
}
.mask {
display: none;
position: absolute;
top: 0;
left: 0;
448px;
height: 252px;
background-color: rgba(0, 0, 0, .3);
/* 这样就不用弄个i再插入图片了;background: rgba(0, 0, 0, .4) url(images/arr.png) no-repeat center; */
}
.mask i {
position: absolute;
top: 50%;
margin-top: -17px;
left: 50%;
margin-left: -17px;
}
/* 下面这个重要的 */
/* 经过盒子,而不是a呢 */
.box:hover .mask {
display: block;
}
</style>
</head>
<body>
<div class="box">
<a href="#"><img src="tudou.jpg" alt=""></a>
<div class="mask">
<i><img src="arr.png" alt=""></i>
</div>
</div>
</body>
</html>