Dorokhov.codes

Drawing text

<text x="140" y="180" stroke="blue">Hello, world!</text>

The words (or other characters) to be drawn are the child content of the element, enclosed between starting and ending <text> and </text> tags.

The text is positioned (by default) in a single line around an anchor point; the anchor is set with x and y attributes.

The text is painted using the fill and stroke properties, the same as for shapes, and not with the CSS color property.

CSS

text {
    font: bold 60px sans-serif;
}