CSS3 transition property
The CSS3 transition property is a CSS3 transition effect. Web designers can use the effect of the CSS3 transition property to adjust the special effects of web page element changes, such as the effect of DIV block size change and the slow effect of web text change. Just use the CSS3 transition property. Set the value in seconds, you can easily create the feeling of slow motion (Slow Motion). However, the transition property of CSS3 is not supported in older browsers. Later, a browser will sort out the support status of CSS3 transition property for your reference. Let’s first look at the grammatical rules of this transition property and what the parameters represent. What does it mean.
Basic syntax of CSS3 transition property
grammar | Description |
transition-property | Used to define the attribute name that can produce the transition attribute effect, such as width, background color... |
transition-duration | Used to define the time when the transition property occurs, in seconds. |
transition-timing-function | It is used to define the occurrence speed of the transition effect, which can be said to be the Bezier curve on which the transition is set. |
transition-delay | Used to define how long the transition effect will take place. |
All browsers support the CSS3 transition property.
Since the transition property is a fairly new CSS3 feature, not all browser versions support it. Old browsers do not support all the latest versions. The effect of the transition attribute is supported. The following is a summary of the degree of support, please refer to it.
- Chrome 26.0 and above are supported, please start with -webkit- for the syntax
- FireFox 16.0 and above are supported. Please use -moz- for the syntax
- Safari 6.1 and above are supported. Please start with -webkit- for the syntax
- Opera 12.1 and above are supported. Please use -o- for the syntax
- IE 10.0 and above are supported
CSS3 transition property example 1. Change the size of the DIV block
#
Change1 { width:60px;
height:60px;
background:blue;
transition:width 5s;
-webkit-transition:width 5s;
-moz-transition:width 5s;
-o-transition :width 5s;
}
#
Change2 { width:60px;
height:60px;
background:yellow;
transition:width 3s;
-moz-transition:width 3s;
-webkit-transition:width 3s;
-o-transition:width 3s;
}
#Change3{
width:60px;
height:60px;
background:red;
transition:width 1s;
-moz-transition:width 1s;
-webkit-transition:width 1s;
-o-transition:width 1s;
}
#Change1:hover,#Change2:hover,#Change3:hover{
width:500px;
}
</style>
<div id="Change1"></div>
<div id=" Change2"></div>
<div id="Change3"></div>
The most important key point of Example 1 is the "transition: width seconds;" grammar, declaring that the transition property of the DIV block will affect only the width (width), which changes according to the set number of seconds. How to write the effect of CSS3 transition on webpage text? Example 2 will provide reference.
CSS3 transition property example two, text color transformation
#TestString{
font-size:25px;
font-weight:bold;
color:#003399;
}
#TestString:hover{
color:#00DB00;
transition:color 3s;
-moz-transition :color 3s;
-webkit-transition:color 3s;
-o-transition:color 3s;
}
</style>
<span id="TestString">Test the gradual color effect of text color</span>
➤Some traditional web design needs JavaScript effects. If the browsers of netizens support CSS3 animation properties, they can be processed directly using CSS3 transition properties, saving the designer the time cost of writing additional JavaScript effects. .
Post a Comment
0 Comments