Skip to content
Related Articles

Related Articles

Improve Article

SVG UseElement.height Property

  • Last Updated : 02 Nov, 2020
Geek Week

The SVG UseElement.height property returns an SVGAnimatedLength object corresponding to the attribute of the given use element

Syntax:

UseElement.height

Return value: This property returns SVGAnimatedLength object that can be used to get the height of the used element.

Example 1: 

HTML




<!DOCTYPE html> 
<html
  
<body>
  <svg width="800" height="800"
        xmlns="http://www.w3.org/2000/svg">        
        <rect id="gfg" 
                x="100" 
                y="100" 
                height="150"
                width="150"
                fill="green"/> 
            
        <use href="#gfg" x="200" y="200" height="150"
             width="150" id="useid"></use
        <script type="text/javascript">
          var u = document.getElementById("useid");
          console.log(u.height);
          console.log(u.height.animVal.value)
        </script>
    </svg
</body>
</html>

Output:



Example 2: 

HTML




<!DOCTYPE html> 
<html
  
<body>
  <svg width="800" height="800"
        xmlns="http://www.w3.org/2000/svg">        
        <image href=
               "https://media.geeksforgeeks.org/wp-content/
               cdn-uploads/20190710102234/download3.png" 
               height="200" width="200" id="gfg"/>
            
        <use href="#gfg" x=0 y=300 height="200" 
             width="200" id="useid"></use
        <script type="text/javascript">
          var u = document.getElementById("useid");
          console.log(u.height);
          console.log(u.height.baseVal.value);
        </script>
    </svg
</body>
</html>

Output:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :