移动端初级知识点解析:translateZ translateY rotateY(上上上)

<!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;}
		div
		{
			width: 200px;height: 200px;background: black;
			position: absolute;left: 50%;top: 50%;margin: 100px 0 0 -200px;
			transition: 5s;			

		}
		div img
		{
			width: 100%;height: 100%;float: left;

		}
		div:hover
		{
			transform: rotateY(180deg);
		}
	</style>
</head>
<body>
	<div><img src="21312.jpg"></div>
</body>
</html>

核心;transition: 5s;放在div里面就会怎么过来怎么回来。放再:hover就会怎么过去,一瞬间回来。

<!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">
		*{margin: 0;padding:0;list-style: none;}
		div
		{
			width: 200px;height: 200px;background: black;float: left;transition: 1s;
		}
		div img
		{
			width: 100%;height: 100%;float: left;
		}
		#div1:hover
		{
			transform: translateY(-230px);
		}
	</style>
</head>
<body>
	<div id="div1"><img src="21312.jpg"></div>
<div></div>
</body>
</html>
<!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">
		*{margin: 0;padding:0;list-style: none;}
		#div1
		{
			width: 200px;height: 200px;background: black;float: left;transition: 5s;position: absolute;left: 50%;top: 50%;margin: -100px 0 0 -100px;
			transform-style: preserve-3d;

		}
		#div1:hover
		{
			transform:perspective(100px)  rotateY(80deg);
		}
		#div1>div
		{
			width: 100%;height: 100%;background: yellow;position: absolute;transform: translateZ(-90px);
		}
	</style>
</head>
<body>
	<div id='div1'>
	<div></div>
</div>
</body>
</html>
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页