一、进度条
<div class="d1">
<div class="bar"></div>
</div>
.d1 {
width: 400px;
height: 20px;
background-color: gray;
}
.bar {
width: 10%;
height: 20px;
background-color: blue;
animation-name: jindu;
animation-duration: 3s;
}
@keyframes jindu {
0% {}
100% {
width: 90%;
}
}
二、涨水
<div class="d2">
<div class="shui">111</div>
</div>
.d2 {
margin-top: 50px;
width: 300px;
height: 300px;
border-radius: 50%;
background-color: #ccc;
border: 5px solid black;
overflow: hidden;
}
.shui {
width: 100%;
height: 20%;
background-color: skyblue;
position: relative;
top: 100%;
transform: scaleY(-1);
transform-origin: top;
animation-name: shui;
animation-duration: 3s;
animation-timing-function: linear;
}
@keyframes shui {
0% {}
100% {
height: 100%;
}
}
三、纯CSS实现轮番播图
<body>
<div class="center">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</div>
</body>
<style>
* {
margin: 0;
padding: 0;
}
.center {
width: 1000px;
height: 150px;
margin: 0 auto;
background-color: gray;
overflow: hidden;
}
ul {
width: 200%;
list-style: none;
font-size: 50px;
color: white;
line-height: 150px;
text-align: center;
}
ul:hover li {
animation-play-state: paused;
}
li {
width: 250px;
height: 150px;
background-color: #ccc;
float: left;
border: 1px solid blue;
box-sizing: border-box;
animation: move 6s linear infinite;
cursor: pointer;
}
@keyframes move {
0% {}
100% {
transform: translateX(-1000px)
}
}
</style>