From the course: Creating Web Icons with SVG
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Display SVGs from an inline sprite
From the course: Creating Web Icons with SVG
Display SVGs from an inline sprite
- [Voiceover] With an inline SVG sprite in place, it's time to display the symbols where we want them to appear in the page. To do that, we'll refer to each of the symbols using their ID so here ID's are icon discourse. Icon home, icon learn, and icon thoughts. We already know where the icons are going to appear because we're replacing these existing images. So all I need to do here is comment out the image, and then add in the SVG instead. And this is where using SVG sprite becomes really interesting. Because now I get tot tell the browser, hey I have an SVG and I want you to treat it like an SVG and that SVG is over there higher up in the document, so just bring it in to where I want to display right now. To make that work, we'll start by setting up an SVG tag. And I'm going to give it a class because I want it to appear just like the menu icon appeared before. So I'll copy out the same exact class here, and we can also use that class later to style the SVG if we want to. And I'll…
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
-
-
-
-
-
-
(Locked)
Overview of the method1m 22s
-
(Locked)
Create a manual SVG sprite3m 56s
-
(Locked)
Display SVGs from an inline sprite3m 29s
-
(Locked)
Create an optimized SVG sprite with SVGO and spritesh7m 14s
-
(Locked)
Display SVGs from an external sprite2m 49s
-
(Locked)
Patch browser support issues4m 28s
-
(Locked)
-
-
-