--- title: rotateY() slug: Web/CSS/transform-function/rotateY() translation_of: Web/CSS/transform-function/rotateY() ---
rotateY()
函数定义了一个转换,它可以让一个元素围绕纵坐标(垂直轴)旋转,而不会对其进行变形。它的结果是一个{{cssxref("<transform-function>")}} 数据类型。
旋转轴围绕原点旋转,而这个原点通过{{cssxref("transform-origin")}} 属性来定义。
注意: rotateY(a)
相当于 rotate3d(0, 1, 0, a)
.
rotateY()
引起的旋转量由{{cssxref("<angle>")}}指定。如果为正,则顺时针方向移动;如果为负,则逆时针方向移动。
rotateY(a)
a
a
是一个{{cssxref("<angle>")}} ,表示旋转的角度。正数角度表示顺时针旋转,负数则表示逆时针旋转。笛卡儿坐标 ℝ2 | 齐次坐标 ℝℙ2 | 笛卡儿坐标 ℝ3 | 齐次坐标 ℝℙ3 |
---|---|---|---|
This transformation applies to the 3D space and can't be represented on the plane. |
<div>Normal</div> <div class="rotated">Rotated</div>
div { width: 80px; height: 80px; background-color: skyblue; } .rotated { transform: rotateY(60deg); background-color: pink; }
{{EmbedLiveSample("示例", "auto", 180)}}
Specification | Status | Comment |
---|---|---|
{{SpecName("CSS Transforms 2", "#funcdef-rotatey", "rotateY()")}} | {{Spec2("CSS Transforms 2")}} | Initial definition |
有关兼容性信息,请参阅 <transform-function>
的数据类型。