The CSS transform origin is the point used when constructing an element's CSS transform matrix. The construction translates by the origin, applies the CSS transform functions, then translates by the negated origin. With homogeneous column vectors, its form iswhere is the matrix product for the function list and translates by the origin .[ref]
CSS Transforms Module Level 1 by World Wide Web Consortium. §3, matrix-construction steps
For an own example, use an ordinary CSS box with a -by--pixel border box,
transform-box: border-box, and no ancestor transforms. The declaration transform-origin: 50% 50% gives in local coordinates. With transform: scale(2), a point maps toThus maps to . The same point scaled about would instead map to .The corresponding two-dimensional homogeneous matrix isIt maps the original corner to while leaving the center fixed. Changing the origin therefore changes the geometry even though the scale function is unchanged.
Percentages require a CSS transform reference box. A horizontal origin percentage uses that box's width and a vertical percentage its height; lengths provide offsets from its top-left corner. The reference-box selection and the point specified within it are two separate inputs.[ref]
CSS Transforms Module Level 1 by World Wide Web Consortium. §5, percentage/length offsets; §6, transform reference box
The example explicitly chooses its box and origin instead of transferring defaults between ordinary CSS boxes and SVG elements. The transform origin is also distinct from the CSS scroll origin, which concerns the alignment of scrollable contents. One governs coordinate transformation; the other anchors scrolling geometry.
New to topics? Read the docs here!