3D转换-正方体

26 篇文章 0 订阅
12 篇文章 0 订阅

按顺序做上 后 下 前 左 右

  • 上 : x轴旋转90度 , z轴正向偏移100px
  • 后 : x轴旋转180度 , z轴正向偏移100px
  • 下 : x轴旋转270度 , z轴正向偏移100px
  • 前 : x轴旋转360度 , z轴正向偏移100px
  • 左 : x轴负向偏移100px , y轴旋转90度
  • 右 : x轴正向偏移100px , y轴旋转90度
<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<style>
		* {
			padding: 0;
			width: 0;
		}
		div {
            position: relative;
			width: 200px;
            height: 200px;
		}
		ul {
			position: absolute;
			left: 400px;
			top: 200px;
			width: 200px;
			height: 200px;
			list-style: none;
            /* border: 1px solid #000;
            box-sizing: border-box; */
            transform: rotateY(0deg) rotateX(0deg);
            transform-style: preserve-3d;
		}
		li {
			position: absolute;
			left: 0;
			top: 0;
			width: 200px;
			height: 200px;
			font-size: 60px;
			line-height: 200px;
			text-align: center;
		}
		
		/* 核心代码 */
		li:nth-child(1) {
			background-color: rgb(163, 99, 99);
			transform: rotateX(90deg) translateZ(100px);
		}
		li:nth-child(2) {
			background-color: rgb(238, 217, 28);
			transform: rotateX(180deg) translateZ(100px);
		}
		li:nth-child(3) {
			background-color: rgb(233, 70, 151);
			transform: rotateX(270deg) translateZ(100px);
		}
		li:nth-child(4) {
			background-color: rgb(107, 47, 218);
			transform: rotateX(360deg) translateZ(100px);
		}
		li:nth-child(5) {
			background-color: rgb(29, 61, 240);
			transform: translateX(-100px) rotateY(90deg);
		}
		li:nth-child(6) {
			background-color: rgb(58, 228, 134);
			transform: translateX(100px) rotateY(90deg);
		}

	</style>
</head>

<body>
	<div>
		<ul>
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
			<li>5</li>
			<li>6</li>
		</ul>
	</div>
</body>

</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值