CSS3实现的div元素水平运动指定距离_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:27:13
Original
1288 people have browsed it

CSS3实现的div元素水平运动指定距离:
本章节分享一段,它实现了利用CSS3让div元素水平运动一段距离。
代码实例如下:

<!DOCTYPE html><html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>蚂蚁部落</title> <style type="text/css">div{  width:100px;  height:100px;  background:green;  position:relative;  animation:theanimation 5s forwards;   -webkit-animation:theanimation 5s forwards; } @keyframes theanimation{   0% {left:0px;}   100% {left:200px;} } @-webkit-keyframes theanimation{   0% {left:0px;}   100% {left:200px;} } </style></head><body><div id="antzone"></div></body></html>
Copy after login

上面的代码实现了我们的要求,代码非常的简单,更多内容可以参阅相关阅读。
相关阅读:
(1).animation可以参阅CSS3的animation属性用法详解一章节。
(2).@keyframes可以参阅CSS3的@keyframes用法详解一章节。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=18160

更多内容可以参阅:http://www.softwhy.com/divcss/

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!