Test1.html

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
.wrap{
margin: 50px auto;
width: 200px;
padding: 200px;
perspective: 800px;
border: 1px dashed #333;
}
.box{
position: relative;
width: 200px;
height: 200px;
line-height: 200px;
font-size: 100px;
text-align: center;
color: #fff;
font-weight: bold;
border: 1px dashed #ccc;
transform-style: preserve-3d;
transform-origin: center center -100px;/*定位的方式,旋转中心点这样设置,但存在兼容性问题*/
transition: 1s;
}
.box div{
position: absolute;
width: 200px;
height: 200px;
}
.box div:nth-of-type(1){
top: -200px;
background-color: red;
transform-origin: bottom;
transform: rotateX(90deg);
}
.box div:nth-of-type(2){
left: -200px;
background-color: green;
transform-origin: right;
transform: rotateY(-90deg);
}
.box div:nth-of-type(3){
background-color: blue;
}
.box div:nth-of-type(4){
right: -200px;
background-color: #333;
transform-origin: left;
transform: rotateY(90deg);
}
.box div:nth-of-type(5){
bottom: -200px;
background-color: yellow;
transform-origin: top;
transform: rotateX(-90deg);
}
.box div:nth-of-type(6){
background-color: tan;
transform: translateZ(-200px) rotateX(180deg);
}
.wrap:hover .box{
transform: rotateX(360deg);
}
</style>
</head>
<body>
<div class="wrap">
<div class="box">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
</div>
</body>
</html>

Test2.html

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
.wrap{
margin: 50px auto;
width: 200px;
padding: 200px;
perspective: 800px;
border: 1px dashed #333;
}
.box{
position: relative;
width: 200px;
height: 200px;
line-height: 200px;
font-size: 100px;
text-align: center;
color: #fff;
font-weight: bold;
border: 1px dashed #ccc;
transform-style: preserve-3d;
transform-origin: center center -100px;/*定位的方式,旋转中心点这样设置,但存在兼容性问题*/
transition: 1s;
}
.box div{
position: absolute;
width: 200px;
height: 200px;
}
.box div:nth-of-type(1){
top: -200px;
background-color: red;
transform-origin: bottom;
transform: rotateX(90deg);
}
.box div:nth-of-type(2){
left: -200px;
background-color: green;
transform-origin: right;
transform: rotateY(-90deg);
}
.box div:nth-of-type(3){
background-color: blue;
}
.box div:nth-of-type(4){
right: -200px;
background-color: #333;
transform-origin: left;
transform: rotateY(90deg);
}
.box div:nth-of-type(5){
bottom: -200px;
background-color: yellow;
transform-origin: top;
transform: rotateX(-90deg);
}
.box div:nth-of-type(6){
background-color: tan;
transform: translateZ(-200px) rotateX(180deg);
}
.wrap:hover .box{
transform: rotateX(360deg);
}
</style>
</head>
<body>
<div class="wrap">
<div class="box">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
</div>
</body>
</html>

Test3.html

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
/*不用麻烦设置left,top等值*/
.wrap{
margin: 0 auto;
width: 200px;
height: 200px;
padding: 200px;
border: 1px solid #333;
perspective: 800px;/*!!!*/
}
.box{
width: 200px;
height: 200px;
position: relative;
transform-style: preserve-3d;/*!!!*/
transition: 3s all;
transform: translateZ(-100px) rotateX(0);
}
.box div{
width: 200px;
height: 200px;
line-height: 200px;
color: #fff;
position: absolute;
font-size: 100px;
text-align: center;
}
.box div:nth-of-type(1){
background-color: red;
transform: translateZ(100px);
}
.box div:nth-of-type(2){
background-color: blue;
transform-origin: top;
transform: translateZ(-100px) rotateX(90deg);/*!!!先移到最里面再操作能保证数字是正的,然后再向前移动,然后再控制其父向后移动*/
}
.box div:nth-of-type(3){
background-color: yellow;
transform: translateZ(-100px) rotateX(180deg);/*!!!*/
}
.box div:nth-of-type(4){
background-color: green;
transform-origin: bottom;
transform: translateZ(-100px) rotateX(-90deg);/*!!!*/
}
.wrap:hover .box{
transform: translateZ(-100px) rotateX(270deg);
}
</style>
</head>
<body>
<div class="wrap">
<div class="box">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
</div>
</body>
</html>

css 3d box 实现的一些注意事项的更多相关文章

  1. Intro to CSS 3D transforms

    原文地址:Intro to CSS 3D transforms,本文只是翻译了其中的一部分,省去了作者写文章的原因浏览器兼容部分(已经过时) Perspective 元素需要设置需要设置perspec ...

  2. 从css 3d说到空间坐标轴

    有一次我们说到掷骰子那个游戏,当时是用了一个steps属性+雪碧图来制作帧动画,这当然颇为不错,但其实一开始我想的不是这样的,我想的是用真的3d和动画去做,这个方案涉及到不少空间的知识,今天来给大伙好 ...

  3. css 3D动画

    一.今天让我们来学习一下css 3D吧! 1.首先我们要学习好css3 3d一定要有一定的立体感! 2.再来那就聊聊原理吧! 3.css3 3d 顾名思义是由两个2d名片组成的 但不是让你建立连个2d ...

  4. CSS 3D 的魅力

    作者 | 子慕大诗人 来源 | www.cnblogs.com/1wen/p/9064011.html   前言:   最近玩了玩用css来构建3D效果,写了几个demo,所以博客总结一下.  在阅读 ...

  5. 奇思妙想 CSS 3D 动画 | 仅使用 CSS 能制作出多惊艳的动画?

    本文将从比较多的方面详细阐述如何利用 CSS 3D 的特性,实现各类有趣.酷炫的动画效果.认真读完,你将会收获到: 了解 CSS 3D 的各种用途 激发你新的灵感,感受动画之美 对于提升 CSS 动画 ...

  6. CSS 3D的魅力

    用户1093975发表于Web项目聚集地订阅 151 在这篇文章中: 前言: demo1 demo2 结语: 本文介绍了CSS来实现3D效果,并且有详细代码和解释.建议大家只字不差的阅读.本文的作者是 ...

  7. 一个简单的CSS3+js 实现3D BOX

    <!doctype html><html><head> <meta charset="UTF-8"> <title>Do ...

  8. Codrops 优秀教程:CSS 3D Transforms 实现书本效果

    这个使用  CSS 3D Transforms 实现创意书本效果的来自 Codrops 网站.你可以看到两种类型的书设计:精装书和平装书.这两个效果都可以很容易地使用 CSS 修改.赶紧体验一下吧. ...

  9. 探究 CSS 混合模式\滤镜导致 CSS 3D 失效问题

    今天在写一个小的 CSS Demo,一个关于 3d 球的旋转动画,关于 CSS 3D,少不了会使用下面这几个属性: { transform-style: preserve-3d; perspectiv ...

随机推荐

  1. HTML5开发移动web应用——SAP UI5篇(8)

    本次对之前学习的SAP UI5框架知识进行简单小结.以及重点部分知识的梳理. 1.在UI5使用过程中,命名空间的概念非常重要. 2.一般的sap组件引用格式例如以下: sap.ui.define([ ...

  2. p2p webrtc服务器搭建系列1: 房间,信令,coturn打洞服务器

    中继(relay) 在RTCPeeConnection中,使用ICE框架来保证RTCPeerConnection能实现NAT穿越 ICE,全名叫交互式连接建立(Interactive Connecti ...

  3. 11 redis之rdb快照持久化

    一:Redis持久化配置 Redis的持久化有2种方式[快照,是日志] 二:Rdb快照的配置选项 save 900 1 // 900内,有1条写入,则产生快照 save 300 1000 // 如果3 ...

  4. hadoop 相关工具访问端口(转)

    原文:http://www.tuicool.com/articles/BB3eArJ hadoop系统部署时用到不少端口.有的是Web UI所使用的,有的是内部通信所使用的,有的是监控所使用的.实际系 ...

  5. JQuery 获取URL中传递的参数

    该方法基于JQuery,然后给方法传递URL中的参数名,返回参数值 (function($){    $.getUrlParam = function(name){        var reg = ...

  6. iPhone与iPad开发实战读书笔记

    iPhone开发一些读书笔记 手机应用分类1.教育工具2.生活工具3.社交应用4.定位工具5.游戏6.报纸和杂志的阅读器7.移动办公应用8.财经工具9.手机购物应用10.风景区相关应用11.旅游相关的 ...

  7. Grails 简要

    一.什么是Grails? Grails is an Open Source, full stack, web application framework for the JVM. It takes a ...

  8. Linux的经常使用命令(1) - 指定执行级别

    命令:init [0123456] 执行级别 0:关机 1:单用户 2:多用户状态没有网络服务 3:多用户状态有网络服务 4:系统未使用保留给用户 5:图形界面 6:系统重新启动 经常使用执行级别是3 ...

  9. 【BZOJ1018】[SHOI2008]堵塞的交通traffic 线段树

    [BZOJ1018][SHOI2008]堵塞的交通traffic Description 有一天,由于某种穿越现象作用,你来到了传说中的小人国.小人国的布局非常奇特,整个国家的交通系统可以被看成是一个 ...

  10. Python爬虫-- BeautifulSoup库

    BeautifulSoup库 beautifulsoup就是一个非常强大的工具,爬虫利器.一个灵活又方便的网页解析库,处理高效,支持多种解析器.利用它就不用编写正则表达式也能方便的实现网页信息的抓取 ...