CSS transform 2026-11-05
A CSS transform changes the coordinate mapping used to render a transformable element. Translation, scaling and rotation are examples of CSS transform functions. Their composition maps local points into the parent coordinate system; the CSS transform origin specifies the point around which the transformation is constructed.[ref]
For an own two-dimensional example, use an ordinary CSS box with transform-box: border-box; transform-origin: 0 0;, no ancestor transforms, and local coordinates relative to that top-left origin. This fixes the CSS transform reference box and origin explicitly. Ignore the box's placement offset to isolate the transform itself.
Using homogeneous column vectors, let
The list transform: translate(10px, 0) scale(2); gives the product . Applied to point , the scale acts first:
Reversing the list to scale(2) translate(10px, 0) gives and the result . The translation is scaled in the reversed composition. Matrix multiplication explains the order dependence.[ref]
The zero origin is part of the example, not an irrelevant decoration. A different origin adds translations around the listed operations and can change the mapped point. The simple matrix computation also fixes its column-vector convention instead of relying on an ambiguous phrase such as applying functions in order.
For boxes governed by the CSS box model, a transform changes rendering without rearranging the surrounding normal-flow content. It can nevertheless extend CSS overflow, and transformed geometry affects client rectangles. The absence of normal-flow re-layout is therefore not a claim that every geometrical or scrolling quantity stays fixed.[ref]
The same transformed bounds matter when constructing a CSS scroll snap area. A rendered border can be rotated while its axis-aligned bounding box is used for alignment geometry. Separating layout boxes, coordinate mappings and derived bounds makes these effects easier to calculate.
CSS transform function 2026-11-05
A CSS transform function specifies one coordinate mapping in a CSS transform list. Functions such as translate(), scale(), rotate() and matrix() have defined argument types and geometrical meanings. The list is composed by matrix multiplication, with the CSS transform origin supplying the surrounding origin translations.[ref]
For the two-dimensional function matrix(a,b,c,d,e,f), a homogeneous column-vector convention gives
In particular, and . The six arguments do not fill the displayed matrix row by row.[ref]
For an own example with zero origin, matrix(2,0,0,3,10,-5) maps point to
This combines horizontal scaling by two, vertical scaling by three and a translation. The arguments and coordinates are chosen to isolate the mapping, not to measure a browser's glyph rendering.
Order matters when composing functions. With zero origin, translate(10px,0) scale(2) maps to , while scale(2) translate(10px,0) maps it to . In column-vector form, the first matrix product is and the second ; the translation itself is scaled in the latter.[ref]
The CSS transform reference box is also part of interpreting arguments that use percentages. A function's spelling alone does not determine every resulting coordinate without its lengths, percentage bases, origin and ancestor mappings. The reusable mathematical description is an ordered coordinate transformation with those inputs stated explicitly.
CSS transform origin 2026-11-05
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 is
where is the matrix product for the function list and translates by the origin .[ref]
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 to
Thus maps to . The same point scaled about would instead map to .
The corresponding two-dimensional homogeneous matrix is
It 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]
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.