前端筆記記錄---視訊播放效果的實現(display的使用)
阿新 • • 發佈:2020-12-22
宣告:以下內容為個人學習總結,初衷是方便自己學習複習記錄。如有錯誤之處,煩請多多指正!
實現效果:
實現程式碼:
<!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>