CKTIS / CSS
CSS property `rotate`
The `rotate` property specifies an independent rotation transform: a lone angle such as `90deg` rotates in 2D, while an axis form with `x`, `y`, or `z` describes 3D rotation around a vector through the transform origin.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
none | <angle> | [ x | y | z | <number>{3} ] && <angle>The rotate property specifies an independent rotation transform: a lone angle such as 90deg rotates in 2D, while an axis form with x, y, or z describes 3D rotation around a vector through the transform origin.
The example applies rotate:90deg to a 40-by-20 rectangle; its rotated bounding box is at 110,40 with size 20 by 40, while a second rectangle with transform:none remains 40 by 20.
Grammar: none | <angle> | [ x | y | z | <number>{3} ] && <angle>.
Individual transforms compose in the order translate, rotate, scale, and only then transform. A zero-length axis vector produces no rotation; 0deg still establishes a transform and stacking context, whereas none does not, which affects containment of positioned descendants.
Examples
<!doctype html><meta charset="utf-8"><style>html,body{margin:0}.box{position:absolute;width:40px;height:20px;top:50px;transform-origin:center}#turned{left:100px;rotate:90deg}#plain{left:200px;rotate:none}</style><i id="turned" class="box"></i><i id="plain" class="box"></i><pre id="result"></pre><script>const shape=e=>{const r=e.getBoundingClientRect();return[Math.round(r.left),Math.round(r.top),Math.round(r.width),Math.round(r.height)]},a=shape(turned),b=shape(plain),s=getComputedStyle(turned);if(a.join(',')!=='110,40,20,40'||b.join(',')!=='200,50,40,20'||s.rotate!=='90deg'||s.transform!=='none')throw new Error('rotate mismatch '+[a,b,s.rotate,s.transform]);result.textContent='rotated='+a.join(',')+'; plain='+b.join(',')+'; rotate='+s.rotate+'; transform='+s.transform;</script>Result
rotated=110,40,20,40; plain=200,50,40,20; rotate=90deg; transform=none
The example applies `rotate:90deg` to a 40-by-20 rectangle; its rotated bounding box is at 110,40 with size 20 by 40, while a second rectangle with `transform:none` remains 40 by 20.