transform-origin - SVG: Scalable Vector Graphics 编辑
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.
Usage notes
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 a single <length>
or <percentage>
value is defined, it represents the horizontal offset.
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.
- One-value syntax:
- The value must be a
<length>
, a<percentage>
, or one of the keywordsleft
,center
,right
,top
, andbottom
.
- The value must be a
- Two-value syntax:
- One value must be a
<length>
, a<percentage>
, or one of the keywordsleft
,center
, andright
. - The other value must be a
<length>
, a<percentage>
, or one of the keywordstop
,center
, andbottom
.
- One value must be a
- Three-value syntax:
- The first two values are the same as for the two-value syntax.
- The third value must be a
<length>
. It always represents the Z offset.
Specifications
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 |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论