Detailed explanation of examples of CSS3 implementing smooth transition when hover leaves

巴扎黑
Release: 2018-05-28 17:36:52
Original
8406 people have browsed it

This article mainly introduces the CSS3 implementation of the smooth transition effect when the pseudo-class hover leaves. It has certain reference value. Those who are interested can learn about it.

Due to the animation effect added by the hover pseudo-class, it can only be used when It will be triggered when the mouse is placed on the element, and when the mouse leaves, the effect will be interrupted and it will appear very stiff.

Most people’s idea is to use the onmouseover and onmouseleave events of js to achieve animation effects. In fact, it doesn’t have to be so troublesome, CSS3 can help you solve these problems.

      离开时效果生硬  

Copy after login

Because the p element can only be added to the p element when the :hover pseudo-class is triggered.

When the mouse leaves the p element, the :hover pseudo-class will no longer take effect, and the animation effect written in hover will be lost instantly.

At this time, we should write an identical transition effect on the original element to continue the interrupted animation effect.

      简单解决  

Copy after login

At this time, no matter when the mouse leaves the element, it will return unchanged.

The above is the detailed content of Detailed explanation of examples of CSS3 implementing smooth transition when hover leaves. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!