您好,我的代码存在一些问题,因为动画在这里工作了我的代码:
background-image:url(industry2.jpg);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
border:1px solid red;
-webkit-animation: fadein 2s ease-in ;
-moz-animation: fadein 2s ease-in ;
animation: fadein 2s ease-in ;
width:500px;
height:200px;
background-repeat: no-repeat;
background-position: left top;
padding-top:68px;
position:absolute;
top:2700px;
left:1300px;
@keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
你知道我没有让动画工作,我也不知道该做什么......
答案 0 :(得分:1)
您尚未关闭@keyframes
。我已移除了左侧和顶部位置以便查看。
.container {
background-image: url("http://via.placeholder.com/500x200");
background-size: cover;
border: 1px solid red;
animation: fadein 2s ease-in;
width: 500px;
height: 200px;
background-repeat: no-repeat;
background-position: left top;
padding-top: 68px;
position: absolute;
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
<div class="container">Hello</div>