preserveAspectRatio attribute | preserveAspectRatio property
Gets an XML value that indicates whether to force uniform graphic scaling.
![]() ![]() |
Syntax
| HTML |
|---|
<element preserveAspectRatio="p" ... > |
| JavaScript |
|---|
p = object.preserveAspectRatio |
Property values
Type: Object
A value that determines how viewports are scaled, using the following parameters:
Standards information
- Scalable Vector Graphics: Basic Data Types and Interfaces, Section 4.5.28
Remarks
For elements that establish a new viewport, the preserveAspectRatio property applies only when you provide a value for the viewBox attribute on the same element. If you do not specify the viewBox attribute, the preserveAspectRatio attribute is ignored.
For image elements, preserveAspectRatio specifies how images are fitted relative to the reference rectangle. preserveAspectRatio also determines whether the aspect ratio of the image is preserved with respect to the user coordinate system.
See also
Show:

