Open In App

SVG Document.body Property

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

The SVG Document.body property returns an object which contains the information about the body of the document.

Syntax:

const objRef = document.body

Return value: This property returns an object which contains the information about the body of the document.

Example 1: 

HTML




<!DOCTYPE html> 
<html
  
<body
    <svg width="350" height="500" 
        xmlns="http://www.w3.org/2000/svg">
        <circle cx='100' cy='100'r="100"></circle>
  
        <script>
            console.log(document.body)
        </script>
    </svg>
</body
  
</html>


Output:

Example 2: 

HTML




<!DOCTYPE html> 
<html
  
<body
    <svg width="500" height="500" 
        xmlns="http://www.w3.org/2000/svg">
  
        <text x='100' y='100' font-size="50px">
            GeeksforGeeks
        </text>
  
        <script>
            console.log(document.body)
        </script>
    </svg>
</body
  
</html>


Output:



Last Updated : 30 Mar, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads