首页  >  文章  >  web前端  >  CSS实现3D切换功能的代码示例

CSS实现3D切换功能的代码示例

不言
不言转载
2019-04-03 10:51:322450浏览

本篇文章给大家带来的内容是关于CSS实现3D切换功能的代码示例,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

<!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>

【相关推荐:CSS视频教程

以上是CSS实现3D切换功能的代码示例的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:cnblogs.com。如有侵权,请联系admin@php.cn删除