viewBox

The viewBox attribute defines the position and dimension, in user space, of an SVG viewport.

The value of the viewBox attribute is a list of four numbers:

These numbers are separated by whitespace and/or a comma, which must be treated as a single space.

If specified, the viewBox attribute establishes a new user space with its origin at min-x, min-y and a width and height as specified. The viewport (which is by default the SVG content element's nearest ancestor 'svg' element or the root 'svg' element if there is no such ancestor) will stretch or shrink its contents to fit the viewBox.

The parsed viewBox is stored as a FloatArray with the following structure: 0 - min-x 1 - min-y 2 - width 3 - height

If not specified via attributes, the view box is calculated based on the width and height attributes. If no width or height is specified, the default values are 0, 0, 350, 150

See also