rotateZ()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
試してみましょう
transform: rotateZ(0);
transform: rotateZ(90deg);
transform: rotateZ(-0.25turn);
transform: rotateZ(3.142rad);
回転軸は、 transform-origin
CSS プロパティで定義される原点を通ります。
メモ: rotateZ(a)
は rotate(a)
または rotate3d(0, 0, 1, a)
と等価です。
メモ: 2D 平面での回転とは異なり、 3D での回転はふつう交換可能ではありません。言い換えれば、回転の順番が結果に影響を与えます。
構文
値
例
HTML
html
Normal
Rotated
CSS
css
div {
width: 80px;
height: 80px;
background-color: skyblue;
}
.rotated {
transform: rotateZ(45deg);
background-color: pink;
}
結果
仕様書
Specification |
---|
CSS Transforms Module Level 2 # funcdef-rotatez |