rotateZ()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.
rotateZ()
は CSS の関数で、要素の形を変化させずに Z 軸の周りを回転させる座標変換を定義します。結果は <transform-function>
データ型になります。
試してみましょう
回転軸は、 transform-origin
CSS プロパティで定義される原点を通ります。
メモ: rotateZ(a)
は rotate(a)
または rotate3d(0, 0, 1, a)
と等価です。
メモ: 2D 平面での回転とは異なり、 3D での回転はふつう交換可能ではありません。言い換えれば、回転の順番が結果に影響を与えます。
構文
rotateZ()
で生成される回転の量は、 <angle>
で指定します。正の数であれば、移動は時計回りです。負の数であれば、反時計回りになります。
css
rotateZ(a)
値
例
HTML
html
<div>Normal</div>
<div class="rotated">Rotated</div>
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 |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
rotateZ() |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
transform
プロパティrotate
プロパティ<transform-function>