Summary

SVG allows for a variety of units of measurement, letting you code your documents according to your preferences. Although defaulting to user units (which equate to pixels on the computer screen) unless otherwise specified, SVG allows for variable dimensions for both object and document dimensions. By using percentages, your SVG content can scale in proportion to its container (most often the Web browser).

The viewBox attribute modifies how content is displayed within the SVG document's dimensions. viewBox can be used to alter the location of the top leftmost corner of the content's display, scale the content to match the dimension's of the display, or both.

Knowing the fundamentals of SVG document layout, you're now ready to begin drawing. ...

Get Sams Teach Yourself SVG in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.