gpt4 book ai didi

css - 我的动画 CSS 不适用于 Firefox 和 IE

转载 作者:行者123 更新时间:2023-11-28 07:15:02 25 4
gpt4 key购买 nike

我找到了一个使用动画 css 的代码。它适用于 chrome 但在 firefox 和 IE 中它坚持此代码用云创建了一个伟大的天空。

我缩短了我的代码。

有人可以帮帮我吗?

.sky {
-webkit-animation:sky_background 50s ease-out infinite;
-moz-animation:sky_background 50s ease-out infinite;
-o-animation:sky_background 50s ease-out infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0);
}
.clouds_one
{
-webkit-animation:cloud_one 50s linear infinite;
-moz-animation:cloud_one 50s linear infinite;
-o-animation:cloud_one 50s linear infinite;
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
-o-transform:translate3d(0,0,0)
}
@-webkit-keyframes cloud_one {
0% {left:0}
100% {left:-200%}
}
@-moz-keyframes cloud_one {
0% {left:0}
100% {left:-200%}
}

最佳答案

好的...您有一些 CSS 错误(缺少分号),这可能是原始问题并且缺少一些供应商前缀声明,而且我认为,一些-前缀版本。

但是,为了完整起见,我在下面的 Stack Snippet 中提供了完整的 CSS。

编译于Codepen使用后Autoprefixer我强烈推荐使用它。

在 W10 上的 Chrome 45、FF41b 和 IE Edge 中测试。

.sky {
height: 580px;
background: #007fd5;
position: relative;
overflow: hidden;
-webkit-animation: sky_background 50s ease-out infinite;
-moz-animation: sky_background 50s ease-out infinite;
-o-animation: sky_background 50s ease-out infinite;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
float: right;
width: 100%;
padding: 0px 0px;
position: relative;
right: 0px
}
.clouds_one {
background: url('http://project.exceliran.com/ProjectForm/img/clouds/cloud_one.png');
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 300%;
-webkit-animation: cloud_one 50s linear infinite;
-moz-animation: cloud_one 50s linear infinite;
-o-animation: cloud_one 50s linear infinite;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
-webkit-animation-name: bounce;
animation-name: bounce;
-webkit-animation-duration: 4s;
animation-duration: 4s;
-webkit-animation-iteration-count: 10;
animation-iteration-count: 10;
-webkit-animation-direction: alternate;
animation-direction: alternate;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.clouds_two {
background: url('http://project.exceliran.com/ProjectForm/img/clouds/cloud_two.png');
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 300%;
-webkit-animation: cloud_two 75s linear infinite;
-moz-animation: cloud_two 75s linear infinite;
-o-animation: cloud_two 75s linear infinite;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0)
}
.clouds_three {
background: url('http://project.exceliran.com/ProjectForm/img/clouds/cloud_three.png');
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 300%;
-webkit-animation: cloud_three 100s linear infinite;
-moz-animation: cloud_three 100s linear infinite;
-o-animation: cloud_three 100s linear infinite;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0)
}
@-webkit-keyframes sky_background {
0% {
background: #007fd5;
color: #007fd5
}
50% {
background: #007fd5;
color: #a3d9ff
}
100% {
background: #007fd5;
color: #007fd5
}
}
@-webkit-keyframes moon {
0% {
opacity: 0;
left: -200%;
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
}
50% {
opacity: 1;
-moz-transform: scale(1);
left: 0%;
bottom: 250px;
-webkit-transform: scale(1);
}
100% {
opacity: 0;
bottom: 500px;
-moz-transform: scale(0.5);
-webkit-transform: scale(0.5);
}
}
@-webkit-keyframes cloud_one {
0% {
left: 0
}
100% {
left: -200%
}
}
@-webkit-keyframes cloud_two {
0% {
left: 0
}
100% {
left: -200%
}
}
@-webkit-keyframes cloud_three {
0% {
left: 0
}
100% {
left: -200%
}
}
#webdesign {
float: right;
width: 100%;
box-sizing: border-box;
padding: 20px;
}
@keyframes cloud_one {
0% {
left: 0
}
100% {
left: -200%
}
}
@keyframes cloud_two {
0% {
left: 0
}
100% {
left: -200%
}
}
@keyframes cloud_three {
0% {
left: 0
}
100% {
left: -200%
}
}
<div class="sky">
<div class="moon"></div>
<div class="clouds_one"></div>
<div class="clouds_two"></div>
<div class="clouds_three"></div>
</div>

关于css - 我的动画 CSS 不适用于 Firefox 和 IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32402228/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com