Home > Web Front-end > Front-end Q&A > How many transition properties are there in css3?

How many transition properties are there in css3?

青灯夜游
Release: 2021-12-15 13:39:42
Original
2167 people have browsed it

There are 5: 1. transition-property attribute; 2. transition-duration attribute; 3. transition-timing-function attribute; 4. transition-delay attribute; 5. transition attribute.

How many transition properties are there in css3?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

css3 transition allows us to change from one attribute value to another within a limited time.

There are 5 css3 transition attributes:

Attribute Description CSS
transition Abbreviation attribute, used to set four transition attributes in one attribute. 3
transition-property Specifies the name of the CSS property that applies the transition. 3
transition-duration Define how long the transition effect takes. The default is 0. 3
transition-timing-function Specifies the time curve of the transition effect. The default is "ease". 3
transition-delay Specifies when the transition effect starts. The default is 0. 3

Example:

Use all transition properties in one example:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style>
			div {
				width: 100px;
				height: 100px;
				background: red;
				transition-property: width;
				transition-duration: 1s;
				transition-timing-function: linear;
				transition-delay: 2s;
				/* Safari */
				-webkit-transition-property: width;
				-webkit-transition-duration: 1s;
				-webkit-transition-timing-function: linear;
				-webkit-transition-delay: 2s;
			}

			div:hover {
				width: 200px;
			}
		</style>
	</head>
	<body>

		<div></div>

		<p>鼠标移动到 div 元素上,查看过渡效果。</p>
		<p><b>注意:</b> 过渡效果需要等待两秒后才开始。</p>

	</body>
</html>
Copy after login

How many transition properties are there in css3?

The same transition effect as the above example, but using the abbreviated transition attribute:

There are so many transition codes in div{} in the above example

div
{
    transition-property: width;
    transition-duration: 1s;
    transition-timing-function: linear;
    transition-delay: 2s;
    /* Safari */
    -webkit-transition-property:width;
    -webkit-transition-duration:1s;
    -webkit-transition-timing-function:linear;
    -webkit-transition-delay:2s;
}
Copy after login

In fact, you only need to use the abbreviated transition attribute and use two lines of code to do it:

div
{
    transition: width 1s linear 2s;
    /* Safari */
    -webkit-transition:width 1s linear 2s;
}
Copy after login

(Learning video sharing: css video tutorial)

The above is the detailed content of How many transition properties are there in css3?. 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