移动的白云

无限运动的云雾
1、页面搭建HTML代码如下:

<div class="sky">/*背景盒子*/
    <div class="clouds_one"></div>/*第一张相片*/
    <div class="clouds_two"></div>/*第二张相片*/
    <div class="clouds_three"></div>/*第三张相片*/
</div>

2、背景的设置代码如下:

 html, body {
    margin: 0;padding: 0;height: 100%;
}
.sky {
    height: 100%;background: #007fd5;
    position: relative;overflow: hidden; /*超出隐藏*/
}

3、第一张相片设置的代码

.sky .clouds_one {
	background: url('../../Content/yunwu/images/cloud_one.png');
	background-size: 46% 84%;
	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);
	-ms-transform: translate3d(0, 0, 0);
	-o-transform: translate3d(0, 0, 0);
	transform: translate3d(0, 0, 0);
	animation: cloud_one 50s linear infinite;
 }
@keyframes cloud_one {
    0% {left: 0;}
    100% {left: -138%;}
}
浏览器兼容性
@-webkit-keyframes cloud_one {
    0% {left: 0;}
    100% {left: -138%;}
}
浏览器兼容性
@-moz-keyframes cloud_one {
    0% {left: 0;}
    100% {left: -138%;}
}

4、第二张相片的设置

.sky .clouds_two {
    background: url('../../Content/yunwu/images/cloud_two.png');
    background-size: 46% 84%;
    position: absolute;left: 0;top: 0;height: 100%;width: 370%;
    /*浏览器兼容性代码*/
    -webkit-animation: cloud_two 80s linear infinite;
    -moz-animation: cloud_two 80s linear infinite;
    -o-animation: cloud_two 80s linear infinite;
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    animation: cloud_two 80s linear infinite;
}
@keyframes cloud_two {
    0% {left: 0;}
    100% {left: -170%;}
}
浏览器兼容性
@-webkit-keyframes cloud_two {
    0% left: 0;}
    100% {left: -170%;}
}
浏览器兼容性
@-moz-keyframes cloud_two {
    0% {left: 0;}
    100% {left: -170%;}
}    

5、第三张相片的设置

.sky .clouds_three {
    background-image: url('../../Content/yunwu/images/cloud_three.png');
    background-size: 50% 84%;
    position: absolute;left: 0;top: 0;height: 100%;width: 300%;
    /*浏览器兼容性代码*/
    -webkit-animation: cloud_three 130s linear infinite;
    -moz-animation: cloud_three 130s linear infinite;
    -o-animation: cloud_three 130s linear infinite;
    -webkit-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    animation: cloud_three 130s linear infinite;
}
@keyframes cloud_three {
    0% { left: 0;}
    100% {left: -150%;}
}
浏览器兼容性
@-webkit-keyframes cloud_three {
    0% {left: 0;}
    100% {left: -150%;}
}
浏览器兼容性
@-moz-keyframes cloud_three {
    0% {left: 0;}
    100% {left: -150%;}
}

6、展示图
在这里插入图片描述

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值