前端笔记记录---视频播放效果的实现(display的使用)

声明:以下内容为个人学习总结,初衷是方便自己学习复习记录。如有错误之处,烦请多多指正!

实现效果:

在这里插入图片描述

实现代码:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<style>
	.box {
     
     
		width: 400px;
		height: 533px;
		margin: 80px auto;
		position: relative;
	}
	/*遮罩层*/
	.mask{
     
     
		width: 400px;
		height: 533px;
		background: rgba(0,0,0,.3) url(imgs/play.png) no-repeat center center;
		/*遮罩层相对于box进行定位,大小与box相同*/
		position: absolute;
        top: 0;
        left: 0;
        /*隐藏,不保留位置*/
        display: none;
	}
	/*鼠标经过时,遮罩层重新显示*/
	.box a:hover .mask {
     
     
		display: block;
	}
</style>

<body>	
	<div class="box">
		<a href="#">
			<div class="mask"></div>
			<img src="imgs/test.jpg" alt="剧照">
	   </a>
	</div>	
</body>
</html>

猜你喜欢

转载自blog.csdn.net/pilgrim_121/article/details/111193856