Home > Web Front-end > CSS Tutorial > Code example of CSS implementing 3D switching function

Code example of CSS implementing 3D switching function

不言
Release: 2019-04-03 10:51:32
forward
2527 people have browsed it

The content of this article is about the code examples for implementing 3D switching function in CSS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

<!DOCTYPE html>
<html>
<head>
    <title>Demo</title>
  <style>
       #app{
           width: 100px;
           height: 35px;
           background-color: #006600;
           text-align: center;
           line-height: 35px;
           position: relative;
           transform-style: preserve-3d;
           transition: all 0.3s linear;
       }
       #app:hover{
           transform: rotateX(90deg);
           transition: all 0.3s linear;
           -webkit-transform-origin: 50% 0;
       }
       #app:before{
           position: absolute;
           top: 100%;
           left: 0;
           content: attr(data-hover);
           width: 100px;
           height: 35px;
           transform: rotateX(-90deg);
           transition: all 0.3s linear;
           transform-origin: 50% 0;
           text-align: center;
           line-height: 35px;
            background-color: red;
       }
    </style>
 
<div>
    <div id="app" data-hover="asdasdasd">
        asdasdasd
    </div>
</div>
</body>
</html>
Copy after login

【Related recommendations: CSS video tutorial

The above is the detailed content of Code example of CSS implementing 3D switching function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:cnblogs.com
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