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. 36:字符串排序SortString

    题目描述:编写一个程序,将输入字符串中的字符按如下规则排序. 规则1:英文字母从A到Z排列,不区分大小写. 如,输入:Type 输出:epTy 规则2:同一个英文字母的大小写同时存在时,按照输入顺序排 ...

  2. wampserver 安装多个php版本号报错之关键问题

    近期喜欢上用wampserver来搭建php本地执行环境 主要是一键安装 特easy 之前一直用的是 appserv 也挺好用的 用了wamp后 才发现wamp更好用 duang duang 默认下载 ...

  3. java中url正则regex匹配

    String regex = "^(?:https?://)?[\\w]{1,}(?:\\.?[\\w]{1,})+[\\w-_/?&=#%:]*$"; 解释说明: ^ : ...

  4. 果园里有一堆苹果,一共n头(n大于1小于9)熊来分,第一头为小东,它把苹果均分n份后,多出了一个,它扔掉了这一个,拿走了自己的一份苹果,接着第二头熊重复这一过程,即先均分n份,扔掉一个然后拿走一份,以此类推直到最后一头熊都是这样(最后一头熊扔掉后可以拿走0个,也算是n份均分)。问最初这堆苹果最少有多少个。

    include "stdafx.h" // ConsoleApplication12.cpp : 定义控制台应用程序的入口点. // #include<iostream> ...

  5. HDFS源码分析EditLog之读取操作符

    在<HDFS源码分析EditLog之获取编辑日志输入流>一文中,我们详细了解了如何获取编辑日志输入流EditLogInputStream.在我们得到编辑日志输入流后,是不是就该从输入流中获 ...

  6. H2 database 应用

    以前对内存表的引用一直采用sqllite,由于sqllite对字段的局限性无法满足需要.后来对h2 有了一定青睐做了下应用.下面对h2进行介绍. 1. H2数据库引擎 H2数据库由Java编写的,它可 ...

  7. python 基础 2.8 python练习题

    python 练习题:   #/usr/bin/python #coding=utf-8 #@Time   :2017/10/26 9:38 #@Auther :liuzhenchuan #@File ...

  8. GS与网络打交道

    与网络打交道 在GS,GC,Share都与网络打交道,但还是GC最多 GC打交道过程 send_stat BaseChannel::SendCmdTry() { if (!m_queCmd.size( ...

  9. Angular入门(四) Router 替换当前页面

    1.在 xx.html 中直接 写标签       <a [routerLink]="['/home']">home</a>   2.在 xx.html 中 ...

  10. 按模板导出Excel

    说明:开发环境 vs2012 asp.net mvc4 c# 注意:Excel模板有多个sheet页,导出Excel的时候,同时给多个sheet页填充数据 1.项目结构 3.Excel模板(注意she ...