、\n\n\n\n多组动画\n\n\n\n\nhtml lang=\en\>\nhead>\n meta charset=\UTF-8\>\n title>Documenttitle>\n style>\n div{\n width: 200px;\n height: 200px;\n background-color: pink;\n animation: go 2s ;/*定义动画
、
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div{
width: 200px;
height: 200px;
background-color: pink;
animation: go 2s ;/*定义动画 在下面要定义一个动画*/
/*animation:动画名称 动画时间 运动曲线 何时开始 播放次数 是否反方向;*/
/*动画名称是自己定义的 go google*/
/*infinite 无限循环*/
/*一般情况下,我们就用前2个 animation: go 2s*/
}
@keyframes go{
0% /*起始位置 相当于from*/{
transform: translate3d(0,0,0);
}
25%{
transform: translate3d(800px,0,0);
}
50%{
transform: translate3d(800px,400px,0);
}
75%{
transform: translate3d(0,400px,0);
}
100% /*结束位置 相当于to*/{
transform: translate3d(0,0 ,0);
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div{
width: 200px;
height: 200px;
background:url(imgc/car.jpg) no-repeat;
background-size: 200px;
animation: car 5s ;*//*定义动画 在下面要定义一个动画
/*animation:动画名称 动画时间 运动曲线 何时开始 播放次数 是否反方向;*/
/*动画名称是自己定义的 go google*/
/*infinite 无限循环*/
/*一般情况下,我们就用前2个 animation: go 2s*/
}
@keyframes car{
0%{
transform:: translate3d(0,0,0);
}
50%{
transform: translate3d(1000px,0,0);
}
51%{/*车要掉头*/
transform: translate3d(1000px,0,0) rotateY(180deg);
/*如果有多组变形 我们用空格隔开就好了*/
}
100%{
transform: translate3d(0,0,0) rotateY(180deg);
}
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin: 0px;
padding: 0px;
}
ul{
list-style: none;
}
nav{
width: 882px;
height: 86px;
border: 1px solid #ccc;
margin:100px auto;
overflow: hidden;/*多出的部分隐藏*/
}
ul li{
float: left;
}
nav ul{
width: 200%;/*父亲的宽度两倍*/
animation: moveing 5s linear infinite; /*引用动画 无限循环 匀速运动*/
}
/*定义动画*/
@keyframes moveing{
from{
transform: translateX(0);
}
to{
transform: translateX(-882px);
}
}
nav:hover ul{
animation-play-state: paused;/*鼠标放上暂停动画*/
}
</style>
</head>
<body>
<nav>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<!-- 为了无缝连接 -->
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</nav>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/*以前的做法*/
/*section{*/
/*width: 80%;可以跟随浏览器的大小缩放*/
/*height: 200px;*/
/*border: 1px solid #ccc;*/
/*margin:100px auto;*/
/*}*/
/*section div{*/
/*width: 33.33%;*/
/*height: 100%;*/
/*float: left;*/
/*}*/
/*section div:first-child{*/
/*background-color: pink;*/
/*}*/
/*section div:last-child{*/
/*background-color: pink;*/
/*}*/
section{
width: 80%;/*可以跟随浏览器的大小缩放*/
height: 200px;
border: 1px solid #ccc;
margin:100px auto;
/*父盒子 添加flex属性*/
display: flex;/*伸缩布局模式*/
flex-direction: row;/*横向排列 column 可以水平也可以垂直 还有row-reverse column-reverse*/
min-width: 280px;/*最小宽度不小于280*/
max-width: 1280px;
}
section div{
height: 100%;
/*flex: 1;给子盒子每一个添加份数*/
}
section div:first-child{
background-color: pink;
flex: 1;
/*width:300px; 固定宽度 这个就是300不变 她不能伸缩了*/
}
section div:nth-child(2){
background-color: #ccc;
margin: 0 5px;
flex: 2;/*第一个盒子固定宽度 然后剩下了的宽度2和3分*/
}
section div:last-child{
background-color: pink;
flex: 1;/*第一个盒子固定宽度 然后剩下了的宽度2和3分*/
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
本站为非盈利网站,如果您喜欢这篇文章,欢迎支持我们继续运营!
本站主要用于日常笔记的记录和生活日志。本站不保证所有内容信息可靠!(大多数文章属于搬运!)如有版权问题,请联系我立即删除:“abcdsjx@126.com”。
QQ: 1164453243
邮箱: abcdsjx@126.com