Using an inline SVG

We have one other option for SVG, called an inline SVG. Since an SVG is really just XML inside of a text file, we can actually embed the SVG code directly into our HTML. This makes it so that we don't need to have an additional HTTP request (good for performance). Also, it allows us to alter the SVG using CSS, for example, provides a cool hover state or an animation. This really gives us a huge advantage; it just can't be overstated.

So what we're going to do is go to the images folder in Sublime Text and open up crab.svg. But first, let's look at what happens when I open crab.png, Sublime shows an image:

With the SVG, ...

Get Mastering CSS 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.