码迷,mamicode.com
首页 > Web开发 > 详细

css3-3D立方体效果

时间:2016-06-27 19:44:42      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;

}
#box{
  width: 300px;
  height: 300px;
  list-style: none;
  position: relative;
  margin: 100px auto;
  -webkit-transform-style:preserve-3d;
  perspective:800px;
  perspective-origin:center center;
  transform:rotateX(-20deg) rotateY(20deg) rotateZ(0deg);

}
#box li{
  position: absolute;
  width: 300px;
  height: 300px;
  text-align: center;
  line-height: 300px;
}
#box li:nth-child(1){
  background: #D390C4;
  opacity: 0.5;
  -webkit-transform:translateZ(150px);
  -ms-transform:translateZ(150px);
  -moz-transform:translateZ(150px);
  -o-transform:translateZ(150px);
  transform:translateZ(150px);
}
#box li:nth-child(2){
  background: #358D36;
  opacity: 0.5;
  transform:translateZ(-150px);
}
#box li:nth-child(3){
  background: #C9CA3C;
  opacity: 0.5;
  transform:translateY(-150px) rotateX(-90deg);
}
#box li:nth-child(4){
background: #741961;
opacity: 0.5;
transform:translateY(150px) rotateX(-90deg);
}
#box li:nth-child(5){
background: #3CB1BF;
opacity: 0.5;
transform:translateX(-150px) rotateY(-90deg);
}
#box li:nth-child(6){
background:#D75A3F;
opacity: 0.5;
transform:translateX(150px) rotateY(-90deg);
}

</style>
</head>
<body>
<ul id="box">
<li>第一面</li>
<li>第二面</li>
<li>第三面</li>
<li>第四面</li>
<li>第五面</li>
<li>第六面</li>
</ul>
</body>
</html>

css3-3D立方体效果

标签:

原文地址:http://www.cnblogs.com/patriot/p/5620874.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!