Home Web Front-end HTML Tutorial Use of css3 transition attribute_html/css_WEB-ITnose

Use of css3 transition attribute_html/css_WEB-ITnose

Jun 24, 2016 pm 12:00 PM
css3 transition Attributes

Transition is to smoothly transition an attribute from one attribute value to another within a specified time to achieve animation effects.
This attribute is generally used with: hover

Let’s look at an example: Place the mouse on a div, and after 0.2 seconds, the background color of the div element will change to yellow in one second. The change method is linear

1 div{ background-color:red; transition:background-color 1s linear 0.2s;}2 div:hover{ background-color:yellow;}
Copy after login

<div>思思博士</div>
Copy after login

Before the mouse was placed:

The change process 0.2s after the mouse was placed:

The final effect when the mouse is placed on it:

Seeing how everyone uses this attribute here, you should have a good idea.

For this attribute, each parameter has a corresponding attribute name, which means that this attribute can be split and written.

Non-abbreviated form:

1 /*div{ background-color:red; transition:background-color 1s linear 0.2s;}*/2 div{background-color:red; transition-property:background-color; transition-duration:1s; transition-timing-function:linear; transition-delay:0.2s}3 div:hover{ background-color:yellow;}
Copy after login

Transition can also transition multiple effects. 🎜>

1 div{ background-color:red; color:black; height:50px; transition:background-color 1s linear,color 1s linear,height 1s linear;}2 3 div:hover{ background-color:yellow; color:#F00; height:100px;}
Copy after login

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to get integer literal properties in Python without SyntaxError? How to get integer literal properties in Python without SyntaxError? Aug 20, 2023 pm 07:13 PM

How to get integer literal properties in Python without SyntaxError?

Python's dir() function: View the properties and methods of an object Python's dir() function: View the properties and methods of an object Nov 18, 2023 pm 01:45 PM

Python's dir() function: View the properties and methods of an object

How to rename properties of JSON using Gson in Java? How to rename properties of JSON using Gson in Java? Aug 27, 2023 pm 02:01 PM

How to rename properties of JSON using Gson in Java?

What to do if Win11 disk properties are unknown What to do if Win11 disk properties are unknown Jul 03, 2023 pm 04:17 PM

What to do if Win11 disk properties are unknown

Methods and examples of dynamically adding attributes using the Vue.set function Methods and examples of dynamically adding attributes using the Vue.set function Jul 24, 2023 pm 07:22 PM

Methods and examples of dynamically adding attributes using the Vue.set function

CSS gradient animation properties: transition and background-image CSS gradient animation properties: transition and background-image Oct 27, 2023 pm 01:18 PM

CSS gradient animation properties: transition and background-image

bottom attribute syntax in CSS bottom attribute syntax in CSS Feb 21, 2024 pm 03:30 PM

bottom attribute syntax in CSS

What is the role of pageXOffset attribute in JavaScript? What is the role of pageXOffset attribute in JavaScript? Sep 16, 2023 am 09:17 AM

What is the role of pageXOffset attribute in JavaScript?

See all articles