Skip to content
Related Articles

Related Articles

SVG RectElement.height Property
  • Last Updated : 25 Oct, 2020

The SVG RectElement.height property returns an SVGAnimatedLength with respect to the rect element of SVG element of the HTML web page.

Syntax:

RectElement.height

Return Values: This property returns SVGAnimatedLength object that can be used to get the “height” of the rect element

Example 1: 

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="350" 
        xmlns="http://www.w3.org/2000/svg">
          
        <rect width="100" height='100' 
            fill="green" id="gfg" x=20 y=40 />
              
        <script>
            var g = document.getElementById("gfg");
            console.log(g.height)
        </script>
    </svg>
</body>
  
</html>

chevron_right


Output:



Example 2: 

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="350" 
        xmlns="http://www.w3.org/2000/svg">
          
        <rect width="100" height='190' 
            fill="green" id="gfg" x=20 y=40 />
              
        <script>
            var g = document.getElementById("gfg");
            console.log(g.height)
        </script>
    </svg>
</body>
  
</html>

chevron_right


Output:

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :