CSS3 example of a smooth transition when hover left

Source: Internet
Author: User
This article mainly introduces the CSS3 implementation of pseudo-class hover left when the smooth transition effect example, with a certain reference value, interested can understand

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

Most people's idea is to use the JS onmouseover and OnMouseLeave events to achieve animation effects. In fact, it needn't be so troublesome, CSS3 can help you solve these problems.

<! DOCTYPE html>    

The effect can be added to the P element only if the P element is triggered by the hover pseudo-class.

When the mouse leaves the P element,: hover pseudo-class will no longer take effect, instantly lose hover in the animation effect written.

At this point, we should write an identical transition effect on the original element, and will leave the animation effect of the broken off on the continuation.

<! DOCTYPE html>

At this point, no matter when the mouse leaves the element, it will return as it is.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.