Skip to Content
Mastering SVG
book

Mastering SVG

by Rob Larsen
September 2018
Beginner to intermediate
312 pages
7h 22m
English
Packt Publishing
Content preview from Mastering SVG

SVG as an image src

The easiest way to get SVG into a document is as the src of an img element. Doing so, as we saw in Chapter 1Introducing Scalable Vector Graphics, is as simple as referencing the *.svg element the same way you would reference any image as the src attribute on an img element. 

As for accessibility, if you follow best practices with regards to accessibility and images, you can continue to do the same with SVG images. The alt attribute should be there and, if it's needed for AT, it should properly describe the content (https://webaim.org/techniques/alttext/). You might wonder why you would have to do this, especially with an SVG image that already has descriptive text as part of its source. Note that any textual content ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern SVG

Modern SVG

Amelia Bellamy-Royds, Kurt Cagle
Using SVG with CSS3 and HTML5

Using SVG with CSS3 and HTML5

Amelia Bellamy-Royds, Kurt Cagle, Dudley Storey
SVG Text Layout

SVG Text Layout

Amelia Bellamy-Royds, Kurt Cagle

Publisher Resources

ISBN: 9781788626743Supplemental Content