css之鼠标悬浮效果实现
程序员文章站
2022-04-28 11:27:06
...
css之鼠标悬浮效果实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>鼠标悬浮</title>
<style>
.container{
background-color: red;
}
.container:after{
content: '.';
display: block;
clear: both;
visibility: hidden;
height: 0px;
}
.container .item{
background-color: red;
width: 180px;
height: 100px;
border: 1px solid red;
position:relative;
}
.left{
float: left;
}
.container .left img{
width: 180px;
height: 100px;
}
.back{
background-color: black;
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
width: 180px;
height: 100px;
opacity: 0.6;
border: 1px solid green;
display: none;
}
.price{
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
display: none;
}
.container .item:hover .back{
display: block;
}
.container .item:hover .price{
display: block;
}
</style>
</head>
<body>
<div class="container">
<div class="item left">
<div><img src="1.png"></div>
<div class="back"></div>
<div class="price">111</div>
</div>
<div class="item left">
<div><img src="1.png"></div>
<div class="back"></div>
<div class="price">222</div>
</div>
<div class="item left">
<div><img src="1.png"></div>
<div class="back"></div>
<div class="price">333</div>
</div>
</div>
</body>
</html>
下一篇: 一个不易被发现的PHP后门代码解析