Detailed explanation of the css3 transition animation of menu bar 'three' transforming into 'X'

高洛峰
Release: 2017-03-06 11:13:51
Original
2571 people have browsed it

I recently wanted to imitate a page. One of the effects is that the three menu bars are transformed into X.

The effect is as follows:

菜单栏 “三” 变形为“X”css3过渡动画详解

Picture (1) Initial effect

菜单栏 “三” 变形为“X”css3过渡动画详解

Picture (2) Mouse hover effect

Idea:

The implementation of three horizontal lines: Traditionally, it can be achieved with three span tags, but there is a more clever method. One tag can achieve the three horizontal effect. According to Master Zhang Xinxu shared the idea of ​​using padding to achieve the effect of three with one label. The general principle is to use border-top, background and border-bottom for the upper, middle and lower horizontal lines respectively. Use background-clip: content-box to cut, and finally use padding to spread it up and down to achieve the visual effect of three horizontal lines, the realization of

X: and the deformed X There is no need for additional labels, and it is implemented using its own after before pseudo-class transform rotation and offset. It takes patience to adjust the angle.

It should be noted that using padding to achieve the three-horizontal effect, the trigger is not very sensitive. It is best to wrap the icon label with a label, and do: hover trigger on the wrapping layer

The following is the code




 
 Document
 


 

Copy after login

More menu bar "three" transforms into "X" css3 transition animation for detailed explanation. Please pay attention to the PHP Chinese website for related articles!

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
Popular Tutorials
More>
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!