0 votes
in Image Classification by
How do you control the aspect ratio of SVG for different viewports?

1 Answer

0 votes
by

SVG’s aspect ratio can be controlled using the ‘preserveAspectRatio’ attribute. This attribute ensures that the SVG scales proportionally and fits within its viewport without distortion. The value of this attribute is a string that combines alignment and meetOrSlice parameters. Alignment dictates how an SVG aligns within the viewport, with nine possible values defined by xMinYMin to xMaxYMax. MeetOrSlice determines how the SVG scales if the aspect ratio doesn’t match the viewport’s. ‘meet’ scales the SVG uniformly until all sides fit within the viewport while ‘slice’ does so until it covers the entire viewport. If not specified, the default value is ‘xMidYMid meet’.

Related questions

0 votes
asked Oct 24, 2019 in HTML by SakshiSharma
0 votes
asked Feb 6 in Image Classification by SakshiSharma
...