Open In App

SVG <use> Element

SVG stands for Scalable Vector Graphic. It can be used to make graphics and animations like in HTML canvas.

The SVG <use> element takes nodes from within the SVG document and duplicates them somewhere else.



Syntax:

<use href="" >
    Subtext
</use>

Attribute:



Example 1: 




<!DOCTYPE html>
<html>
 
<body>
    <svg width="400" height="200"
        xmlns="http://www.w3.org/2000/svg">      
        <circle id="gfg"
                cx="100"
                cy="100"
                r="40"
                fill="green"/>
         
        <use href="#gfg" x="110"></use>
    </svg>
</body>
 
</html>

Output:

 

Example 2: 




<!DOCTYPE html>
<html>
 
<body>
    <svg width="400" height="200"
        xmlns="http://www.w3.org/2000/svg"
        <a href="https://ide.geeksforgeeks.org"
           id="gfg">     
            <text x="50"
                  y="90"
                  text-anchor="middle">
                Click Here
            </text>
        </a>
        <use href="#gfg"
             y="110"></use>
    </svg>
</body>
 
</html>

Output:

Supported Browsers:


Article Tags :