Home>Article>Web Front-end> What are the triggering methods using css transition?

What are the triggering methods using css transition?

醉折花枝作酒筹
醉折花枝作酒筹 Original
2021-04-29 17:43:08 3231browse

The triggering methods are: 1. Triggered through the pseudo-class element ":hover", the syntax is "element {transition: attribute transition time} element:hover {attribute: attribute value}"; 2. Through "element.classList The .add("element name")" statement triggers the css transition effect.

What are the triggering methods using css transition?

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

The first type: Triggered through pseudo-class elements

 

The second type: Triggered through JS

There must be a certain delay when added through js (delay removal has no effect) Change the style of elements

 

setTimeout(() => { let element = document.getElementsByClassName('box')[0]; element.classList.add('box1') }, 1)

Recommended learning:css video tutorial

The above is the detailed content of What are the triggering methods using css transition?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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