Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the delay of css3 animation for a few seconds

Shulou Source: shulou.com Published: 2022-06-01 05:31:09 11月10日 Update

This article is about how to set a delay of a few seconds for css3 animation. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

In css3, you can set the animation delay by a few seconds using the "animation-delay" attribute, which defines when the animation starts. The attribute value can be in seconds "s" or milliseconds "ms", and the syntax is "animation-delay: time;".

Operating environment of this tutorial: Windows 10 system, CSS3 && HTML5 version, Dell G3 computer.

CSS3 Animation How to set delay for a few seconds

The animation-delay property defines when the animation starts.

Animation-delay values can be in seconds (s) or milliseconds (ms).

Tip: Allow negative values,-2s to start the animation right away, but skip 2 seconds into the animation.

syntax

animation-delay: time;

Time is optional. Defines the time, in seconds or milliseconds, to wait before the animation starts. Default is 0

Examples are as follows:

123 div{ width:100px; height:100px; background:red; position:relative; animation:mymove 5s infinite; animation-delay:3s; Safari and Chrome*/ -webkit-animation:mymove 5s infinite; -webkit-animation-delay:3s;}@keyframes mymove{ from {left:0px;} to {left:200px;}}@-webkit-keyframes move/*Safari and Chrome*/{ from {left:0px;} to {left:200px;}}

Note: The animation-delay property is incompatible with Internet Explorer 9 and earlier browsers.

The output animation is delayed by 3 seconds, and the result is as follows:

Thank you for reading! About "css3 animation how to set a delay of a few seconds" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Animation delay attributes content units time more articles results grammar good practical useful that is tutorials articles time browsers versions environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno NVidia vpn MySQL