/

HTML / CSS / JavaScript Tutorial

CSS Property: transition-delay

[this page | pdf | back links]

The CSS (CSS3) transition-delay property indicates when a transition will start.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

time

The CSS time to wait before transition effect starts

 

Default Value:

0s

JavaScript syntax:

e.g. object.style.transitionDelay="5s"

Inherited:

No

Animatable:

No

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
p {width: 200px; border: 2px solid green; transition: width 1s;}
p.x1 {transition-delay: 2s}
p:hover {width: 300px;}
</style>
</head>
<body>
Hover over element to see transition effect
<p>Element with default property</p>
<p class="x1">Property set using HTML</p>
<p id="x2">Property set using JavaScript</p>

<script>
document.getElementById("x2").style.transitionDelay = "2s";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyTransitionDelay() {
  var x = document.createElement("DIV"); x.style.transitionDelay = "2s"; return (window.getComputedStyle(x, null).transitionDelay == "2s");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile