SVG: Viewport
viewport is the region where SVG elements are rendered.
The size of viewport can be set via width
and height
attributes.
By default, the top left corner of the viewport has coordinate {0,0}. That is, x = 0 and y = 0. this point is called the origin.
Changing the width
or height
does not change the origin.
Viewport Width Height via CSS
The dimension of viewport can be set via CSS too.
Viewport with no Width and Height
If width
, height
attributes are not set, the browser automatically determines a size. This is similar to HTML div
element without any width and height.
However, elements inside does not auto resize. Some drawing may be outside of viewport.