遮罩层动画 也是相当于两层 下面那层一开始不显示opacity:0,当鼠标滑过的时候opacity:0.4 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> .box { display: inline-block; width: 227px; height: 309px; border: 4px solid white; box-shadow: 0 0 10px black; border-radius: 50%; overflow: hidden; position: relative; } .box img { width: 100%; height: 100%; } .box:hover .cover{ opacity: 0.4; transform: scale(2); } .cover { position: absolute; left: 0; top: 0; width: 227px; height: 309px; line-height: 309px; border-radius: 50%; text-align: center; font-size: 50px; background-color: black; color: white; opacity: 0; transform: scale(0); transition: all 1s ease; } </style></head><body> <div class="box"> <img src="../img/baby.jpg" alt=""> <div class="cover">Baby</div> </div> <div class="box"> <img src="../img/baby.jpg" alt=""> <div class="cover">Baby</div> </div> <div class="box"> <img src="../img/baby.jpg" alt=""> <div class="cover">Baby</div> </div> <div class="box"> <img src="../img/baby.jpg" alt=""> <div class="cover">Baby</div> </div> <div class="box"> <img src="../img/baby.jpg" alt=""> <div class="cover">Baby</div> </div></body></html>