HTML and CSS Reference
In-Depth Information
</style>
</head>
<body>
<div id="anim1">
Watch me move and change size!
</div>
</body>
</html>
O
NLINE
http://htmlref.com/ch6/animationduration.html
Compatibility
CSS3 Proposed
Chrome 3+, Safari 3.1+
Notes
• WebKit supports this property as
-webkit-animation-duration
.
• Be careful with staggering durations, as the shorter animation will revert to its
nonanimation values once the animation completes.
• Firefox 3.7 pre-releases show support for CSS transitions which are very related to
CSS animation. It is quite likely that a form of this property using the
-moz
prefix
may be supported in a Firefox browser by the time you read this.
animation-iteration-count
This property is used to define the number of times an animation should play.
Syntax
animation-iteration-count:
number
| infinite [,
number
| infinite]*
where
number
is a positive integer and the keyword
infinite
indicates a continuous
animation.
Example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
CSS Animations - animation-iteration-count
</title>
<style type="text/css">
@-webkit-keyframes resize {
from {height: 300px; width: 100px;
left: 0; top: 0;}
50% {height: 100px; width: 100px;
left: 300px; top: 0;}
to {height: 100px; width: 300px;
left: 300px; top: 300px;}
}
@-webkit-keyframes move {
from {left: 150px; top: 150px;}