How to achieve three-dimensional flip effect in css3

WBOY
Release: 2022-01-24 13:37:43
Original
1680 people have browsed it

In CSS3, you can use the transform attribute with the rotate3d(), rotateX(), rotateY() and rotateZ() functions to achieve a three-dimensional flip effect. The syntax is "transform:rotate3d(x,y,z,angle )".

How to achieve three-dimensional flip effect in css3

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

How to achieve three-dimensional flip effect in css3

The transform attribute applies 2D or 3D transformation to the element. This property allows us to rotate, scale, move or tilt the element.

When this attribute is used in conjunction with the four functions rotateX(), rotateY(), rotateZ() and rotate3d(), the three-dimensional flip effect can be achieved.

  • ##Z: Taking the center of the box as the origin, rotate clockwise

  • rotate3d(x,y,z,angle) value description:

x: is a value between 0 and 1, mainly used to describe the vector value of the element rotating around the X axis;

  • y : is a value between 0 and 1, mainly used to describe the vector value of the element rotating around the Y axis;

  • z: is a value between 0 and 1, mainly used To describe the vector value of the element rotating around the Z axis;

  • a: is an angle value, mainly used to specify the angle of rotation of the element in the 3D space. If its value is positive, the element Rotates clockwise, otherwise the element rotates counterclockwise.

  • The three rotation functions introduced below are equivalent in function:

rotateX(a) function is equivalent to rotate3d(1,0,0, a)

  • rotateY(a) function is equivalent to rotate3d(0,1,0,a)

  • rotateZ(a) function Equivalent to rotate3d(0,0,1,a)

  • The example is as follows:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
    .img1{
    transform:rotateX(180deg);
    }
    </style>
    </head>
    <body>
    <img  src="1115.08.png" class="img1" alt="How to achieve three-dimensional flip effect in css3" ><br>
    <img  src="1115.08.png" alt="How to achieve three-dimensional flip effect in css3" >
    </body>
    </html>
    Copy after login

    Output result:

(Learning video sharing:

css video tutorial

) How to achieve three-dimensional flip effect in css3

The above is the detailed content of How to achieve three-dimensional flip effect in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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!