css transition property


  Translation results:

transition

Transition

English [trænˈzɪʃn] US [trænˈzɪʃən, -ˈsɪʃ-]

css transition propertysyntax

Function:The transition property is a shorthand property for setting four transition properties: transition-property transition-duration transition-timing-function transition-delay

Syntax :transition: property duration timing-function delay;

Description: transition-property specifies the name of the CSS property that sets the transition effect. Transition-duration specifies how many seconds or milliseconds it takes to complete the transition effect. Transition-timing-function specifies the speed curve of the speed effect. Transition-delay defines when the transition effect starts.​

Note: Please always set the transition-duration attribute, otherwise the duration is 0 and no transition effect will be produced.

css transition propertyexample

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:blue;
transition:width 2s;
-moz-transition:width 2s; /* Firefox 4 */
-webkit-transition:width 2s; /* Safari and Chrome */
-o-transition:width 2s; /* Opera */
}
div:hover
{
width:300px;
}
</style>
</head>
<body>
<div></div>
<p>请把鼠标指针移动到蓝色的 div 元素上,就可以看到过渡效果。</p>
<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>
</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A