代码:
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);
}
}