May 2019
Beginner to intermediate
650 pages
14h 50m
English
Unlike HTML, you can't simply insert text inside any element. You have to create text objects using the <text> element with text contents. You can position text using x and y attributes, but you must remember that y is actually the baseline (default). If y is zero or not present, only the parts of the text that extend below the baseline will be visible inside the graphics context.
This example places both text and a rectangle in the same position:
<rect x="0" y="0" height="36" width="200"/><text font-size="36" x="0" y="0" fill="lightgray">ghijklmnop</text>
The following illustration shows the result, at left. Note that only the parts of the text that extend below the baseline actually appear over the rectangle. The other two examples ...
Read now
Unlock full access