How to achieve html flip effect

藏色散人
Release: 2021-06-03 11:12:18
Original
5570 people have browsed it

How to implement the flip effect: First, overlay the two images to be displayed using positioning; then use the CSS3 perspective combined with the "transform:rateY()" attribute to achieve the flip effect.

How to achieve html flip effect

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

CSS3 achieves beautiful card flip effect

##Post the rendering first (The actual effect is 1000 times smoother than the gif image, feel free to use it):


这里写图片描述 Mainly uses the
perspective of CSS3 combined with the transform:ratateY() attribute to complete. When you define the perspective attribute for an element, its child elements get the perspective effect, not the element itself. It should be noted that is: the perspective attribute only affects 3D conversion elements. This attribute is now well supported in Firefox and Google Safari. The description of this attribute on W3C.cn has not been updated in time.

The implementation idea is to overlap the two p positionings to be displayed, one of which is first rotated at a certain angle around the Y-axis, and a key attribute is added

backface-visibility:hidden (This property defines whether the element is visible when it is not facing the screen). If you do not add this attribute, you will always be able to see only one card. The effect of failure is as follows:
这里写图片描述 The complete code is posted below:




    
        
        
        
        
        CSS3实现卡片翻转效果
        
    
coser
coser
成为我们的合作coser,漫展返图,自由扩列,以及无偿拍摄&后期服务
苏苏
Copy after login

Okay Take a look at the html structure. Many of them are unnecessary. The most critical structure is as follows. You can also delete the css.


Copy after login

My implementation code is like this, I posted it directly because I am too lazy to delete it.


【Recommended learning:

html video tutorial

The above is the detailed content of How to achieve html flip effect. 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 [email protected]
Latest Issues
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!