CSS写动画

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>loading</title>

<style type="text/css">

.box{

width: 620px;

height: 400px;

border: 3px solid #000;

margin: 0 auto;

}

.red,.green,.pink,.purple,.blue{

width: 100px;

height: 150px;

background-color: red;

float: left;

margin-left: 20px;

margin-top: 110px;

transform: scaleY(0.5);

transition: all 1s ease;

animation: moving 0.7s ease 1s infinite alternate both;

}

.box:hover{

animation-play-state: running;

}

.green{

background-color: green;

transition: all 1s ease;

animation: moving 1s ease 1s infinite alternate both;

}

.pink{

background-color: pink;

transition: all 1s ease;

animation: moving 1.4s ease 1s infinite alternate both;

}

.purple{

background-color: purple;

transition: all 1s ease;

animation: moving 1.7s ease 1s infinite alternate both;

}

.blue{

background-color: skyblue;

transition: all 1s ease;

animation: moving 2s ease 1s infinite alternate both;

}

@keyframes moving{

from{

height: 150px;

}

to{

height: 50px;

}

}

</style>

</head>

<body>

<div class="box">

<div class="red"></div>

<div class="green"></div>

<div class="pink"></div>

<div class="purple"></div>

<div class="blue"></div>

</div>

</body>

</html>

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,400评论 0 11
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 2,009评论 0 2
  • transitiontransition-property 过渡属性transition-duration 过渡持...
    Rella7阅读 470评论 0 0
  • 今天晚上我写完作业画了一幅画儿。 我画了个米小圈,他的头大大的,身体一瘦瘦的,手长长的,腿短短的,嘴巴总是张得很大...
    心似大海阅读 400评论 0 0
  • 吃完午饭,头很痛,回宿舍躺在床上。 打开电台,程一的声音很好听,故事很忧伤,不知不觉入睡。 突然惊醒,发现耳机里传...
    一抹_茶阅读 181评论 0 0

友情链接更多精彩内容