3D变形(CSS3)transform-旋转

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/Liyunhao_haoge/article/details/102646338

3D变形(CSS3)transform-旋转
坐标:
X左边是负的,右边是正的
Y上面是负的,下面是正的
Z里面是负的,外面是正的

3D旋转
transform: rotateX()|rotateY()|rotateZ()

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>

	<style type="text/css">
	div:first-child{
		width: 100px;
		height: 100px;
		background-color: green;
	}
	div:nth-child(2) {
		width: 100px;
		height: 100px;
		background-color: pink;	
		transition: all 3s; /*过渡*/
	}	

	div:nth-child(3) {
		width: 100px;
		height: 100px;
		background-color: red;	
		transition: all 3s; /*过渡*/
	}
	div:nth-child(4) {
		width: 100px;
		height: 100px;
		background-color: yellow;	
		transition: all 3s; /*过渡*/
	}
	div:hover:nth-child(2){
		transform: rotateX(30deg);
	}
	div:hover:nth-child(3){
		transform: rotateY(30deg);	
	}
	div:hover:nth-child(4){
		transform: rotateZ(30deg);	
	}		
	</style>
</head>
<body>
	<div>原图</div>
	<div>3D-X</div>
	<div>3D-Y</div>
	<div>3D-Z</div>		
</body>
</html>

效果如下:

猜你喜欢

转载自blog.csdn.net/Liyunhao_haoge/article/details/102646338