栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

css3绘制魔方

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

css3绘制魔方

效果图1:嵌套            效果图2:不嵌套




3d魔方

* {
margin: 0;
padding: 0;
}
.box {
display: block;
width: 200px;
height: 200px;
margin: 100px auto;
position: relative;
transform-style: preserve-3d;
}
.box:hover {
transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
transition: 10s;
}
li {
list-style: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .3;
}
.small{
position: absolute;
width: 50%;
height: 50%;
top:25%;
left: 25%;
opacity: .6;
}

li:nth-child(1){
transform: translateZ(100px);
background: lightblue;
}
li:nth-child(7){
transform: translateZ(50px);
background: lightblue;
}

li:nth-child(2){
transform: rotateX(90deg) translateZ(100px);
background: lawngreen;
}
li:nth-child(8){
transform: rotateX(90deg) translateZ(50px);
background: lawngreen;
}

li:nth-child(3),li:nth-child(9){
transform: rotateX(180deg) translateZ(100px);
background: pink;
}
li:nth-child(9){
transform: rotateX(180deg) translateZ(50px);
background: pink;
}

li:nth-child(4){
transform: rotateX(270deg) translateZ(100px);
background: greenyellow;
}
li:nth-child(10){
transform: rotateX(270deg) translateZ(50px);
background: greenyellow;
}

li:nth-child(5){
transform: rotateY(90deg) translateZ(100px);
background: yellow;
}
li:nth-child(11){
transform: rotateY(90deg) translateZ(50px);
background: yellow;
}

li:nth-child(6){
transform: rotateY(270deg) translateZ(100px);
background: orange;
}
li:nth-child(12){
transform: rotateY(270deg) translateZ(50px);
background: orange;
}





  • 转载请注明:文章转载自 www.mshxw.com
    本文地址:https://www.mshxw.com/it/242576.html
    我们一直用心在做
    关于我们 文章归档 网站地图 联系我们

    版权所有 (c)2021-2022 MSHXW.COM

    ICP备案号:晋ICP备2021003244-6号