Vachmi

The <text> element is used to draw text in an SVG image.

SVG Text Example

Here is the SVG code to draw this text.

<svg width="200" height="150">
  <text x="20" y="40" style="font-size: 24px">SVG Text Example</text>
</svg>

Code Explanation

• The position of the text is determined by the x and y attributes of the element. The x-attribute determines where to locate the left edge of the text (the start of the text). The y-attribute determines where to locate the bottom of the text (not the top).

• The CSS font-size property defines the size of the text font.

Attributes

x - The x coordinate of the starting point of the text

It can accept a length or a percentage as its value. Default Value: 0


y - The x coordinate of the starting point of the text

It can accept a length or a percentage as its value. Default Value: 0