Home>Article>Web Front-end> What are the triggering methods using css transition?
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.
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!