SVG Text Basics
Chapter 2 introduces the SVG <text>
element and the basic attributes for positioning simple text labels within a graphic, including the particular issues of sizing text within a scalable coordinate system.
The links below will open the live example files or high-res PNG or JPEG screenshots in a new browser tab. Alternatively, you can download the entire collection as a zip archive or fork it as a GitHub repository. Be sure to read the O’Reilly Media policy on the use of example code.
- Example 2-1 & Figure 2-1 (basic SVG text):
- Example 2-2 & Figure 2-2 (changing text size):
- Example 2-3 & Figure 2-3 (coordinate systems and text size in inline SVG):
- Figure 2-4 (styled SVG text):
- Example 2-4 & Figure 2-5 (filter effects on SVG text):
- Figure 2-6 (wood lily graphic, without labels):
- Figure 2-7 (wood lily graphic, with title):
- Example 2-5 & Figure 2-8 (wood lily graphic, with interactive labels):
Return to the main table of contents.