我正在尝试将两个 div 类组合在一起,这样它就可以工作了。我正在尝试将这些东西组合在一起,但我不能。我该怎么做?唯一有效的是摇动图像,我希望两者一起工作。我现在将链接一的 .overlay 放入自动风格3。
CSS代码是
img:hover {
animation: shake 0.2s;
animation-iteration-count: infinite;
}
@keyframes shake {
0% { transform: translate(1px, 1px) rotate(0deg); }
10% { transform: translate(-1px, -2px) rotate(-1deg); }
20% { transform: translate(-3px, 0px) rotate(1deg); }
30% { transform: translate(3px, 2px) rotate(0deg); }
40% { transform: translate(1px, -1px) rotate(1deg); }
50% { transform: translate(-1px, 2px) rotate(-1deg); }
60% { transform: translate(-3px, 1px) rotate(0deg); }
70% { transform: translate(3px, 1px) rotate(-1deg); }
80% { transform: translate(-1px, -1px) rotate(1deg); }
90% { transform: translate(1px, 2px) rotate(0deg); }
100% { transform: translate(1px, -2px) rotate(-1deg); }
}
.auto-style3 {
margin-top: 0px;
position: absolute;
bottom: 0;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5); /* Black see-through */
color: #f1f1f1;
width: 100%;
transition: .5s ease;
opacity:0;
color: white;
font-size: 20px;
padding: 20px;
text-align: center;
}
.auto-style4 {
background-color: #FF0000;
}
* {box-sizing: border-box;}
.container {
position: relative;
width: 50%;
max-width: 300px;
}
.image {
display: block;
width: 100%;
height: auto;
}
.container:hover .overlay {
opacity: 1;
}
我的代码是
<div class="container" >
<img src="avatar.jpg" alt="Avatar" width="278" height="262" class="style3" >
<div class="auto-style3">
Avatar is ON
</div>
</div>
holdtom
素胚勾勒不出你
随时随地看视频慕课网APP
相关分类