这次给大家带来CSS实现3d半透明立方体,CSS实现3d半透明立方体的注意事项有哪些,下面就是实战案例,一起来看一下。
效果图如下:
示例代码:
new document //css部分html{font-size:62.5%;}img{width:300px;height:300px;} #stage{//搭建一个舞台margin-top:200px;margin-left:auto;margin-right:auto;width:300px;height:300px;perspective:1200px;font-size:5em;font-weight:bold;color:#cc00ff;} .cube{//cube是正方体position:relative;transform:rotateX(-45deg) rotateY(45deg);transform-style:preserve-3d;transition: all .6s; } .side{color:blue;text-align:center;width:300px;height:300px;line-height:300px;position:absolute;background:#cc66ff;opacity:0.5;border:1px solid rgba(117,4,24,0.5);}//.front到.bottom是6个面分别进行旋转,构建出正方体的整形.front{transform:translateZ(150px);}.back{transform:rotateY(180deg) translateZ(150px);}.left{transform:rotateY(-90deg) translateZ(150px);}.right{transform:rotateY(90deg) translateZ(150px);}.top{transform:rotateX(90deg) translateZ(150px);}.bottom{transform:rotatex(-90deg) translateZ(150px);}#stage:hover .cube{//设置鼠标移上正方体时是否需要过渡效果以及过渡效果开始和结束的时间和速度transform:rotateX(-45deg) rotateY(225deg);transition:transform .6s;}@@##@@
@@##@@
@@##@@
@@##@@
@@##@@
@@##@@
登录后复制
相信看了本文案例你已经掌握了方法,更多精彩请关注【创想鸟】其它相关文章!
推荐阅读:
注意事项
注意事项
注意事项
以上就是CSS实现3d半透明立方体的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2898585.html