1.transition动画
(1)transition-property 设置过渡的属性,比如:width height background-color
(2)transition-duration 设置过渡的时间,比如:1s 500ms
(3)transition-timing-function 设置过渡的运动方式,常用有linear(匀速)| ease(缓冲运动)
(4)transition-delay 设置动画的延迟
(5)transition:property duration timing-function delay; 同时设置
<head>
<Meta charset="utf-8">
<title>transition动画</title>
<style type="text/css">
.Box{ width: 100px; height: 100px; background-color: yellow; transition: all 500ms ease,background-color 2s ease; } .Box:hover{ width: 500px; height: 500px; background-color: red; } </style>
</head>
<body>
<div class="Box"></div>
</body>
<head>
<Meta charset="utf-8">
<title>图片</title>
<style type="text/css">
.Box{ width: 320px; height: 405px; margin: 50px auto 0; position: relative; overflow: hidden; } .text{ width: 320px; height: 100px; position: absolute; top: 405px; background-color: rgba(124,119,0.30); transition: all 500ms ease; } .Box:hover .text{ position: absolute; top: 305px; } </style>
</head>
<body>
<div class="Box">
<img src="images/3_02.png" alt="星空">
<div class="text">
<h3>夜空中最亮的星</h3> <p>我在思考人生</p> </div> </div>
</body>
例子三:夏目
<head>
<Meta charset="utf-8">
<title>joke</title>
<style type="text/css">
@keyframes joke{ from{ left: 0px; } to{ left: -2136px; /*图片宽度*/ } } .Box{ width: 534px; height: 300px; margin: 50px auto; overflow: hidden; position: relative; } .Box img{ position: absolute; animation: joke 1s steps(4) infinite; } </style>
</head>
<body>
<div class="Box"> <img src="images/xia.png" alt="夏目友人帐"> </div>
</body>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。