移动端上上(transform-translateZ注册)

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style type="text/css">
		*{padding: 0px;margin: 0px;list-style: none;}
		#div1
		{
			width: 200px;height: 200px;background: black;
			position: absolute;left: 50%;top: 50%;margin: -100px 0 0 -100px;
			transform-style: preserve-3d;
			transform: perspective(800px);
			transition: 1s;

		}
		#div1>#div2
		{
			width: 100%;height: 100%;background: green;position: absolute;
			transform: translateZ(1px);/*3d变换中的移动,z中的正方向面向用户,值越大,越靠近用户。*/
		}
		#div1>#div3
		{
			width: 100%;
			height: 100%;background: green;position: absolute;
			transform:scaleX(-1) translateZ(-1px);
			/*scaleX(-1)负数代表镜像*/
		}
	</style>
</head>
<body>
	<script type="text/javascript">
		window.onload=function()
		{
		var btn1=document.getElementById("btn1");
		var btn2=document.getElementById("btn2");
		btn1.onclick=function()
		{
			div1.style.transform='rotateY(180deg)';
		}
		btn2.onclick=function()
		{
			div1.style.transform="rotateY(180deg) translateY(-500px)";
			div1.style.opacity=0;
		}

	}
	</script>
	<div id="div1">
		<div id="div2">
			<input type="button" value="我想注册" id="btn1">
		</div>
		<div id="div3">
			用户名:
			<input type="text"><br>
			密码:<input type="password" name="" id="">
			<input type="button" value="提交" id="btn2">
		</div>
	</div>
</body>
</html>
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页