arrow_back
Back

Drawing text

Andrew Dorokhov Andrew Dorokhov schedule 1 min read
menu_book Table of Contents
<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;
}
code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

Working with JS

arrow_forward