Why does svg text disappear when x and y are set to 0?

I just started reading about svgand I came up with the following question

I am creating a simple svgc textinside as shown below.

From my reading I realized that xand ytag textdeclares the position of text within the space svg.

Why, when I set both x, and yin 0, the text is not displayed, and when I change xand yto 10, for example, it is displayed? Is it not x=0, and y=0is the top left corner of the svg tag?

thank

<svg width="200" height="100">
   <text x="0" y="0">hello</text>
</svg>
+3
source share
2 answers

, (0,0) SVG ( , , ).

<text x="0" y="0">hello</text> (0,0), , SVG.

: <text x="0" y="0">goodbye</text>. "g" "y" SVG.

, y, , :

<svg width="200" height="100">
   <text x="0" y="1em">hello</text>
</svg>

JSFiddle , .

+6

<text> , dominant-baseline: hanging :

<text x="0" style="dominant-baseline: hanging;">Hello</text>

.

0

All Articles