H5实现摩天轮

代码:

html:css效果

<head>
	<meta charset="utf-8" />
	<title>幸福摩天轮</title>
	<link rel="stylesheet"  href="css/mtl.css" />
</head>
<body>
	<div>
	<ul>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
	</ul>
	</div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
</body>

css:

@charset “utf-8”;

body{
background: url(…/img/2.jpg) no-repeat;
background-size:cover;
}
/匹配div父元素的第n个子元素/
div:nth-child(1){
width: 768px;
height: 768px;
background: url(…/img/fsw.png);
position: absolute;
left: 50%;
/向左移动自身的一半/
margin-left: -384px;
animation: zhuan 15s linear infinite;
}
ul{
list-style: none;

}
li:nth-child(1){
width: 130px;
height: 170px;
background: url(…/img/shamegirl.png);
position: absolute;
left: 50%;
margin-left: 200px;
top: 100px;
animation: renzhuan 15s linear infinite;

}
li:nth-child(2){
width: 130px;
height: 170px;
background: url(…/img/dog.png);
position: absolute;
left: 50%;
margin-left: -300px;
top: 100px;
animation: renzhuan 15s linear infinite;

}
li:nth-child(3){
width: 130px;
height: 170px;
background: url(…/img/boy.png);
position: absolute;
left: 50%;
margin-left: 0px;
top: 0px;
animation: renzhuan 15s linear infinite;

}
li:nth-child(4){
width: 130px;
height: 170px;
background: url(…/img/girls.png);
position: absolute;
left: 50%;
margin-left:170px;
top: 500px;
animation: renzhuan 15s linear infinite;

}
li:nth-child(5){
width: 130px;
height: 170px;
background: url(…/img/mimi.png);
position: absolute;
left: 50%;
margin-left:0px;
top: 650px;
animation: renzhuan 15s linear infinite;

}
div:nth-child(2){
width: 247px;
height: 490px;
background: url(…/img/bracketsmall.png);
position: absolute;
left: 50%;
margin-left: -126px;
top: 387px;
/设置在后面/
z-index: -1;

}
div:nth-child(3){
width: 358px;
height: 529px;
background: url(…/img/bracket.png);
position: absolute;
left: 50%;
margin-left: -182px;
top: 380px;

}
div:nth-child(4){

width: 577px;
height: 257px;
background: url(../img/big-title.png);
position: absolute;
left: 50%;
margin-left: -250px;
top: 250px;

}
div:nth-child(5){

width: 413px;
height: 139px;
background: url(../img/title.png);
position: absolute;
left: 50%;
margin-left: -140px;
top: 440px;

}

@keyframes zhuan {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

@keyframes renzhuan {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-360deg);
}
}

效果:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值