鼠標hover時改變圖片透明度和顏色


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>鼠標hover時改變圖片透明度和顏色</title>
<style>
* {
margin:0;
padding: 0;
}

.wrap{
border: 1px solid pink;
width: 300px;
height:250px;
position: relative;
overflow: hidden;
}
.pic,.bac {
width: 300px;
height:250px;
position: absolute;
}
.bac {
background: pink;
opacity: 0.6;
display: none;
}
img {
width: 300px;
height:250px;
}
.wrap:hover .bac{
display: block;
}
.wrap:hover .txt{
display: block;
}
.txt {
font-size: 40px;
position: absolute;
text-align: center;
left: 50%;
top:30%;
color:orangered;
display: none;
}
</style>
</head>
<body>
<div class="wrap">
<div class="pic">
<img src="img/1.png">
</div>
<div class="bac"></div>
<div class="txt">+</div>
</div>
</body>
</html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM