首页 / CSS / css3控制div上下跳动
css3控制div上下跳动
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了css3控制div上下跳动,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1703字,纯文字阅读大概需要3分钟。
内容图文
![css3控制div上下跳动](/upload/InfoBanner/zyjiaocheng/1318/e8e11d0089e6497891c2a68dd46ddc2b.jpg)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
@-webkit-keyframes bounce-down {
25% {
-webkit-transform: translateY(-10px);
}
50%, 100% {
-webkit-transform: translateY(0);
}
75% {
-webkit-transform: translateY(10px);
}
}
@keyframes bounce-down {
25% {
transform: translateY(-10px);
}
50%, 100% {
transform: translateY(0);
}
75% {
transform: translateY(10px);
}
}
.animate-bounce-down{ background:#333; width: 100px; height: 100px; margin:100px auto;
-webkit-animation: bounce-down 1.5s linear infinite;
animation: bounce-down 1.5s linear infinite;
}
@-webkit-keyframes bounce-up {
25% {
-webkit-transform: translateY(10px);
}
50%, 100% {
-webkit-transform: translateY(0);
}
75% {
-webkit-transform: translateY(-10px);
}
}
@keyframes bounce-up {
25% {
transform: translateY(10px);
}
50%, 100% {
transform: translateY(0);
}
75% {
transform: translateY(-10px);
}
}
.animate-bounce-up{ background:#ddd; width: 100px; height: 100px; margin:100px auto;
-webkit-animation: bounce-up 1.4s linear infinite;
animation: bounce-up 1.4s linear infinite;
}
</style>
</head>
<body>
<div class="animate-bounce-up"></div>
<div class="animate-bounce-down"></div>
</body>
</html>
这个例子是直接应用css3来控制div层上下来回滚动;
这需要熟练应用@keyframes 规则,@keyframes bounce-down中的bounce-down是个动作名称,这个元素可以自行定义,只要在 animation: bounce-up匹配到就可以的。
原文:http://www.cnblogs.com/wangyongx/p/5022529.html
内容总结
以上是互联网集市为您收集整理的css3控制div上下跳动全部内容,希望文章能够帮你解决css3控制div上下跳动所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。