transform与坐标系统

默认元素transform 的旋转、缩放、平移、斜切的坐标系统的原点为该元素的几何中心。

transform-origin 属性

transform-origin 属性允许更改转换元素的位置,即原点。

语法

transform-origin: x-axis y-axis z-axis;

2d 中去掉 z-axi 即可。

	<style type="text/css">
		div {width: 800px; height: 250px; background: #abcdef; margin:auto;}
		div > img {
			transform: scale(0.3,0.3) rotateZ(10deg);
			transform-origin: 25% top;
		}
	</style>

猜你喜欢

转载自blog.csdn.net/purple_lumpy/article/details/83550227