The transform-origin
SVG attribute sets the origin for an item’s transformations.
Note: As a presentation attribute in SVG, transform-origin
corresponds in syntax and behavior to the transform-origin
property in CSS, and can be used as CSS property to style SVG. See the CSS transform-origin property for more information.
Values |
[ <length-percentage> | left | center | right | top | bottom ] | [ [ <length-percentage> | left | center | right ] && [ <length-percentage> | top | center | bottom ] ] <length>? where |
Default value | 0, 0 |
Animatable | Yes |
The default value of transform-origin
is 0 0
for all SVG elements except for root <svg>
elements and <svg>
elements that are a direct child of a foreignObject, and whose transform-origin is 50% 50%
, like other CSS elements.
The transform-origin
property may be specified using one, two, or three values, where each value represents an offset. Offsets that are not explicitly defined are reset to their corresponding initial values.
If two or more values are defined and either no value is a keyword, or the only used keyword is center
, then the first value represents the horizontal offset and the second represents the vertical offset.
<length>
, a <percentage>
, or one of the keywords left
, center
, right
, top
, and bottom
.<length>
, a <percentage>
, or one of the keywords left
, center
, and right
.<length>
, a <percentage>
, or one of the keywords top
, center
, and bottom
.<length>
. It always represents the Z offset.Specification | Status | Comment |
CSS Transforms Level 1 The definition of 'transform-origin' in that specification. | Working Draft | |
Scalable Vector Graphics (SVG) 2 The definition of 'transform-origin' in that specification. | Candidate Recommendation |
© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform-origin