SVGPreserveAspectRatio

SVG preserveAspectRatio interface

SVGPreserveAspectRatio interface corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements.

An SVGPreserveAspectRatio object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.

Interface overview

Also implement None
方法 None
特性
  • unsigned short align
  • unsigned short meetOrSlice
常量
  • SVG_PRESERVEASPECTRATIO_UNKNOWN = 0
  • SVG_ PRESERVEASPECTRATIO _NONE = 1
  • SVG_ PRESERVEASPECTRATIO _XMINYMIN = 2
  • SVG_ PRESERVEASPECTRATIO _ XMIDYMIN = 3
  • SVG_ PRESERVEASPECTRATIO _ XMAXYMIN = 4
  • SVG_ PRESERVEASPECTRATIO _ XMINYMID = 5
  • SVG_ PRESERVEASPECTRATIO _ XMIDYMID = 6
  • SVG_ PRESERVEASPECTRATIO _ XMAXYMID = 7
  • SVG_ PRESERVEASPECTRATIO _ XMINYMAX = 8
  • SVG_ PRESERVEASPECTRATIO _ XMIDYMAX = 9
  • SVG_ PRESERVEASPECTRATIO _ XMAXYMAX = 10
  • SVG_MEETORSLICE_UNKNOWN = 0
  • SVG_ MEETORSLICE _MEET = 1
  • SVG_ MEETORSLICE _SLICE = 2
Normative document SVG 1.1 (2nd Edition)

常量

Name 描述
SVG_ PRESERVEASPECTRATIO _UNKNOWN 0 The enumeration was set to a value that is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_ PRESERVEASPECTRATIO _NONE 1 Corresponds to value none for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMINYMIN 2 Corresponds to value xMinYMin for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMIDYMIN 3 Corresponds to value xMidYMin for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMAXYMIN 4 Corresponds to value xMaxYMin for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMINYMID 5 Corresponds to value xMinYMid for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMIDYMID 6 Corresponds to value xMidYMid for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMAXYMID 7 Corresponds to value xMaxYMid for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMINYMAX 8 Corresponds to value xMinYMax for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMIDYMAX 9 Corresponds to value xMidYMax for attribute preserveAspectRatio .
SVG_ PRESERVEASPECTRATIO _XMAXYMAX 10 Corresponds to value xMaxYMax for attribute preserveAspectRatio .
SVG_MEETORSLICE_UNKNOWN 0 The enumeration was set to a value that is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_MEETORSLICE_MEET 1 Corresponds to value meet for attribute preserveAspectRatio .
SVG_MEETORSLICE_SLICE 2 Corresponds to value slice for attribute preserveAspectRatio .

特性

Name Type 描述
align unsigned short The type of the alignment value as specified by one of the SVG_PRESERVEASPECTRATIO_* constants defined on this interface.
meetOrSlice unsigned short The type of the meet-or-slice value as specified by one of the SVG_MEETORSLICE_* constants defined on this interface.

Exceptions on setting: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised on an attempt to change the value of an attribute on a read only object.

方法

SVGPreserveAspectRatio interface do not provide any specific methods.

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
SVGPreserveAspectRatio Chrome Yes Edge ≤18 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持
完整支持
兼容性未知
兼容性未知
  1. SVGPreserveAspectRatio
  2. Related pages for SVG
    1. SVGAElement
    2. SVGAltGlyphElement
    3. SVGAngle
    4. SVGAnimateColorElement
    5. SVGAnimateElement
    6. SVGAnimateMotionElement
    7. SVGAnimateTransformElement
    8. SVGAnimatedAngle
    9. SVGAnimatedBoolean
    10. SVGAnimatedEnumeration
    11. SVGAnimatedInteger
    12. SVGAnimatedLength
    13. SVGAnimatedLengthList
    14. SVGAnimatedNumber
    15. SVGAnimatedNumberList
    16. SVGAnimatedPathData
    17. SVGAnimatedPoints
    18. SVGAnimatedPreserveAspectRatio
    19. SVGAnimatedRect
    20. SVGAnimatedString
    21. SVGAnimatedTransformList
    22. SVGAnimationElement
    23. SVGCircleElement
    24. SVGClipPathElement
    25. SVGComponentTransferFunctionElement
    26. SVGCursorElement
    27. SVGDefsElement
    28. SVGDescElement
    29. SVGDocument
    30. SVGElement
    31. SVGEllipseElement
    32. SVGFEBlendElement
    33. SVGFEColorMatrixElement
    34. SVGFEComponentTransferElement
    35. SVGFECompositeElement
    36. SVGFEConvolveMatrixElement
    37. SVGFEDiffuseLightingElement
    38. SVGFEDisplacementMapElement
    39. SVGFEDistantLightElement
    40. SVGFEDropShadowElement
    41. SVGFEFloodElement
    42. SVGFEFuncAElement
    43. SVGFEFuncBElement
    44. SVGFEFuncGElement
    45. SVGFEFuncRElement
    46. SVGFEGaussianBlurElement
    47. SVGFEImageElement
    48. SVGFEMergeElement
    49. SVGFEMergeNodeElement
    50. SVGFEMorphologyElement
    51. SVGFEOffsetElement
    52. SVGFEPointLightElement
    53. SVGFESpecularLightingElement
    54. SVGFESpotLightElement
    55. SVGFETileElement
    56. SVGFETurbulenceElement
    57. SVGFilterElement
    58. SVGFilterPrimitiveStandardAttributes
    59. SVGFitToViewBox
    60. SVGFontElement
    61. SVGFontFaceElement
    62. SVGFontFaceFormatElement
    63. SVGFontFaceNameElement
    64. SVGFontFaceSrcElement
    65. SVGFontFaceUriElement
    66. SVGForeignObjectElement
    67. SVGGElement
    68. SVGGlyphElement
    69. SVGGradientElement
    70. SVGGraphicsElement
    71. SVGHKernElement
    72. SVGImageElement
    73. SVGLength
    74. SVGLengthList
    75. SVGLineElement
    76. SVGLinearGradientElement
    77. SVGMPathElement
    78. SVGMarkerElement
    79. SVGMaskElement
    80. SVGMatrix
    81. SVGMetadataElement
    82. SVGMissingGlyphElement
    83. SVGNumber
    84. SVGNumberList
    85. SVGPathElement
    86. SVGPathSeg
    87. SVGPathSegArcAbs
    88. SVGPathSegArcRel
    89. SVGPathSegClosePath
    90. SVGPathSegCurvetoCubicAbs
    91. SVGPathSegCurvetoCubicRel
    92. SVGPathSegCurvetoCubicSmoothAbs
    93. SVGPathSegCurvetoCubicSmoothRel
    94. SVGPathSegCurvetoQuadraticAbs
    95. SVGPathSegCurvetoQuadraticRel
    96. SVGPathSegCurvetoQuadraticSmoothAbs
    97. SVGPathSegCurvetoQuadraticSmoothRel
    98. SVGPathSegLinetoAbs
    99. SVGPathSegLinetoHorizontalAbs
    100. SVGPathSegLinetoHorizontalRel
    101. SVGPathSegLinetoRel
    102. SVGPathSegLinetoVerticalAbs
    103. SVGPathSegLinetoVerticalRel
    104. SVGPathSegList
    105. SVGPathSegMovetoAbs
    106. SVGPathSegMovetoRel
    107. SVGPatternElement
    108. SVGPoint
    109. SVGPointList
    110. SVGPolygonElement
    111. SVGPolylineElement
    112. SVGRadialGradientElement
    113. SVGRect
    114. SVGRectElement
    115. SVGSVGElement
    116. SVGScriptElement
    117. SVGSetElement
    118. SVGStopElement
    119. SVGStringList
    120. SVGStylable
    121. SVGStyleElement
    122. SVGSwitchElement
    123. SVGSymbolElement
    124. SVGTRefElement
    125. SVGTSpanElement
    126. SVGTests
    127. SVGTextContentElement
    128. SVGTextElement
    129. SVGTextPathElement
    130. SVGTextPositioningElement
    131. SVGTitleElement
    132. SVGTransform
    133. SVGTransformList
    134. SVGTransformable
    135. SVGURIReference
    136. SVGUnitTypes
    137. SVGUseElement
    138. SVGVKernElement
    139. SVGViewElement
    140. SVGZoomAndPan
    141. SVGZoomEvent
    142. TimeEvent