Fatih Can Işık
Fatih Can Işık

Reputation: 33

Show path title on path

I want to show the path title always on the path not while hover.

this is the example path code:

<svg height="210" width="400">
  <path d="M150 0 L75 200 L225 200 Z" title="theTitle" />
</svg>

I want to get theTitle and place it on the path, so how can I do this?

Upvotes: 1

Views: 651

Answers (2)

doğukan
doğukan

Reputation: 27441

You can use title tag by grouping it with paths you want to show it with.

<svg height="210" width="400">
  <g>
    <title>First title</title>
    <path d="M150 0 L75 200 L225 200 Z" />
  </g>
  <g>
    <title>Second title</title>
    <path d="M350 0 L175 400 L325 400 Z" />
  </g>
</svg>

Upvotes: 4

GucciBananaKing99
GucciBananaKing99

Reputation: 1506

You can use a normal <title>-tag for svg icons.

Here's the code:

<svg height="210" width="400">
  <path d="M150 0 L75 200 L225 200 Z"/>
  <title>Hello World!</title>
</svg>

Upvotes: 3

Related Questions