Front-end note recording---Realization of video playback effect (use of display)

Statement: The following content is a summary of personal study, the original intention is to facilitate their own study and review records. If there are any errors, please correct me!

Realization effect:

Insert picture description here

Implementation code:

<!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>

Guess you like

Origin blog.csdn.net/pilgrim_121/article/details/111193856