CSS Value Time

The CSS Value Time, <time>,  represents a time value expressed in seconds or milliseconds. It is used in animation, transition, and related properties.

Syntax:

<number>units

Property Values:

  • <number>: It represents the amount of time or duration we want. It can be preceded by a single + or sign.
  • units: It is the representation. It can be s, ms.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
<style
div {
  width: 100px;
  height: 100px;
  background: green;
  position: relative;
  animation: mymove infinite;
  animation-duration: 3s;/*CSS | Time */
}
  
@keyframes mymove {
  from {top: 0px;}
  to {top: 200px;}
}
</style>
</head>
<body>
<center><div></div></center>
</body>
</html>

chevron_right


Output:

Example 2

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
<style
div {
  width: 100px;
  height: 20px;
  background: green;
  transition: width 2s, height 4s;/*CSS | Time*/
}
  
div:hover {
  width: 300px;
  height: 300px;
}
</style>
</head>
<body>
<div><p style="color:white">GeeksforGeeks</p></div>
</body>
</html>

chevron_right


Output:




My Personal Notes arrow_drop_up

Program Analyst Trainee,Cognizant

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.