Interactive online courses HTML Academy
2026-03-09 10:59 Diff

SVG content may not only be stretched, but also moved left-right or up-down. To do this, you need to specify the position of the content relative to the X and Y axes, such as, for example, using xMinYMid:

<svg viewBox="0 0 237 300" preserveAspectRatio="xMinYMid"> … </svg>

Possible values for each axis:

The position is set using two parameters: the first is always used to specify the X-axis position, and the second is used to specify the Y-axis position. The Y-axis position is always written with a capital letter. Both parameters are required.

The default value is xMidYMid (content is aligned in the middle of the larger side).