From the course: Learning SVG
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Define the display size of an SVG - SVG Tutorial
From the course: Learning SVG
Define the display size of an SVG
- [Instructor] Now that you know how to add an inline SVG to your HTML documents, one of the first questions you'll have is, how do I size this to make it fit with my overall design and layout? Here, you have two main routes you can follow, the old school static size route and the modern responsive web design route. Both of these approaches have their uses and neither of them is wrong, they're just different solutions to different problems. Adobe Illustrator takes the old school route by default. You'll remember in the original SVG code, the SVG element here, had width and height attributes, this is the most direct way of sizing an SVG. By setting the width and height attributes on the SVG element manually, you can force the size of the SVG. So if I go in here and say width="100" and height="100", and save, and reload in the browser, you can see the SVG is now 100 pixels wide and 100 pixels tall. This approach is useful if you want consistent sizing of things like icons or if you have…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Add SVG to a web document3m 54s
-
(Locked)
Define the display size of an SVG3m 8s
-
(Locked)
Understand the viewBox5m 20s
-
(Locked)
SVG shape elements4m 52s
-
(Locked)
Group SVG shapes with <g>2m 54s
-
(Locked)
Reuse SVG symbols with <symbol> and <use>5m 31s
-
(Locked)
Size used SVG symbols6m 14s
-
(Locked)
Apply CSS to individual symbol instances4m 25s
-
-
-
-
-