<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>梦幻西游</title>
</head>
<style>
* {
margin: 0;
padding: 0;
}
html,body {
height: 100%;
overflow: hidden;
}
.back {
height: 100%;
width: 3920px;
background-image: url(./imgs/2.jpg);
margin-left: -2000px;
animation: back_move 30s infinite linear;
}
@keyframes back_move {
from {
margin-left: -1920px;
}
to {
margin-left: 0;
}
}
/* 容器样式 */
.wrap {
height: 300px;
width: 1300px;
/* border: 1px solid #333; */
position: absolute;
top: 50%;
left: 50%;
/* margin-top: -80px; */
margin-left: -350px;
}
.wrap > div {
float: left;
}
/* 孙悟空的窗口 */
.wk {
width: 200px;
height: 180px;
/* border: 1px solid #fff; */
overflow: hidden;
/* margin-top: -60px; */
}
.wk div {
height: 180px;
width: 1600px;
background-image: url(./imgs/west_01_3ca39fe.png);
animation: wk_move 1s infinite steps(8);
}
@keyframes wk_move {
from {
margin-left: 0;
}
to {
margin-left: -1600px;
}
}
/* 八戒的窗口 */
.bj {
width: 200px;
height: 180px;
overflow: hidden;
}
.bj div {
height: 180px;
width: 1600px;
background-image: url(./imgs/west_02_47bad19.png);
animation: bj_move 1s infinite steps(8);
}
@keyframes bj_move {
from {
margin-left: 0;
}
to {
margin-left: -1600px;
}
}
/* 唐僧的窗口 */
.ts {
height: 240px;
width: 170px;
margin-top: -30px;
overflow: hidden;
}
.ts div {
background-image: url(./imgs/west_03_f962447.png);
height: 240px;
width: 1360px;
animation: ts_move 1s infinite steps(8);
}
@keyframes ts_move {
from {
margin-left: 0;
}
to {
margin-left: -1360px;
}
}
/* 沙僧的窗口 */
.ss {
height: 200px;
width: 210px;
overflow: hidden;
}
.ss div {
background-image: url(./imgs/west_04_6516d80.png);
height: 240px;
width: 1680px;
animation: ss_move 1s infinite steps(8);
}
@keyframes ss_move {
from {
margin-left: 0;
}
to {
margin-left: -1680px;
}
}
</style>
<body>
<!-- 背景容器 -->
<div class="back"></div>
<!-- 人的容器 -->
<div class="wrap">
<!-- 孙悟空的窗口 -->
<div class="wk">
<div></div>
</div>
<!-- 八戒的窗口 -->
<div class="bj">
<div></div>
</div>
<!-- 唐僧的窗口 -->
<div class="ts">
<div></div>
</div>
<!-- 沙僧的窗口 -->
<div class="ss">
<div></div>
</div>
</div>
</body>
</html>
利用CSS动画制作梦幻西游动态页面
最新推荐文章于 2021-08-03 19:59:47 发布