The compound writing method of setting animation execution once in css3 is "animation: name time speed delay 1 whether to play in reverse", where "1" represents the number of times the animation is played, that is, the number of times the animation is executed; animation is a Abbreviated attributes, used to specify the action keyframe name, animation time, speed curve, animation delay, animation times, and whether to play the animation in reverse for the element animation.
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
In css3, the animation attribute name is "animation",
This attribute is an abbreviation attribute, used to specify binding The specified keyframe name, animation time, speed curve, animation delay, animation times and whether to play the animation in reverse,
The syntax is:
animation: name duration timing-function delay iteration-count direction fill-mode play-state;
animation- name specifies the name of the keyframe to be bound to the selector
animation-duration animation specifies how many seconds or milliseconds it takes to complete
animation- timing-function Sets how the animation will complete a cycle
animation-delay Sets the delay interval before the animation starts.
animation-iteration-count defines the number of times the animation is played.
animation-direction Specifies whether the animation should be played in reverse in turns.
animation-fill-mode specifies the style to be applied to the element when the animation is not playing (when the animation completes, or when there is a delay before the animation starts playing).
animation-play-state Specifies whether the animation is running or paused.
If the animation is only executed once, just set the animation-iteration-count value to 1.
Examples are as follows:
<style> div { width:100px; height:100px; background:red; position:relative; animation:mymove 3s 1; /* Safari and Chrome */ -webkit-animation:mymove 3s 1; } @keyframes mymove { from {top:0px;} to {top:200px;} } @-webkit-keyframes mymove /* Safari and Chrome */ { from {top:0px;} to {top:200px;} } </style> </head> <body> <p><strong>注意:</strong> Internet Explorer 9 及更早 IE 版本浏览器不支持 animation-iteration-count 属性。</p> <div></div> </body>
Output results:
(Learning video sharing: css video tutorial,html video tutorial)
The above is the detailed content of What is the compound writing method to execute CSS3 animation once?. For more information, please follow other related articles on the PHP Chinese website!