How to use css transition attribute

藏色散人
Release: 2019-05-29 15:23:07
Original
2580 people have browsed it

css transition property is a shorthand property, its syntax is transition: property duration timing-function delay, used to set four transition properties.

How to use css transition attribute

#How to use the css transition attribute?

Function:

The transition property is an abbreviated property used to set four transition properties: transition-property transition-duration transition-timing-function transition -delay

Syntax:

transition: property duration timing-function delay;
Copy after login

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 occur.

css transition attribute usage example

<!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>
Copy after login

Effect output:

How to use css transition attribute

How to use css transition attribute

The above is the detailed content of How to use css transition attribute. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!