鼠标移到图片实现渐变效果:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 300px;
height: 212px;
position: relative;
}
.box img{
width: 300px;
}
.box .title{
position: absolute;
left: 15px;
bottom: 20px;
width: 260px;
color: white;
z-index: 1;
}
.box .mask{
position: absolute;
bottom: 0px;
left: 0px;
width: 300px;
height: 100%;
background-image: linear-gradient(
transparent,
rgba(0,0,0,0.6)
);
opacity: 0;
transition: all .5s;
}
.box:hover .mask{
opacity: 1;
}
</style>
</head>
<body>
<div class="box">
<img src="./img/pic2.png" alt="">
<div class="title">百度一下,你就知道!百度一下,你就知道!百度一下,你就知道!</div>
<div class="mask"></div>
</div>
</body>
</html>
鼠标移到滚轮上实现车轮走动
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.test{
width: 1000px;
height: 200px;
border: 1px solid black;
}
.test img{
width: 200px;
transition: all 5s;
transform-origin: center;
}
.test img:hover{
transform: translate(800px) rotate(18000deg);
}
</style>
</head>
<body>
<div class="test">
<img src="./img/tyre.png" alt="">
</div>
</body>
</html>