SVG <텍스트>


SVG 텍스트 - <텍스트>

<text> 요소는 텍스트를 정의하는 데 사용됩니다.


실시예 1

텍스트 쓰기:

I love SVG! Sorry, your browser does not support inline SVG.

다음은 SVG 코드입니다.

예시

<svg height="30" width="200">
  <text x="0" y="15" fill="red">I love SVG!</text>
</svg>

실시예 2

텍스트 회전:

I love SVG Sorry, your browser does not support inline SVG.

다음은 SVG 코드입니다.

예시

<svg height="60" width="200">
  <text x="0" y="15" fill="red" transform="rotate(30 20,40)">I love SVG</text>
</svg>


실시예 3

<text> 요소는 <tspan> 요소를 사용하여 여러 하위 그룹에 배열할 수 있습니다. 각 <tspan> 요소는 다른 형식과 위치를 포함할 수 있습니다.

여러 줄의 텍스트(<tspan> 요소 포함):

Several lines: First line. Second line. Sorry, your browser does not support inline SVG.

다음은 SVG 코드입니다.

예시

<svg height="90" width="200">
  <text x="10" y="20" style="fill:red;">Several lines:
    <tspan x="10" y="45">First line.</tspan>
    <tspan x="10" y="70">Second line.</tspan>
  </text>
</svg>

실시예 4

링크로서의 텍스트(<a> 요소 포함):

I love SVG! Sorry, your browser does not support inline SVG.

다음은 SVG 코드입니다.

예시

<svg height="30" width="200" xmlns:xlink="http://www.w3.org/1999/xlink">
  <a xlink:href="https://www.w3schools.com/graphics/" target="_blank">
    <text x="0" y="15" fill="red">I love SVG!</text>
  </a>
</svg>