Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Object vspace Property

  • Last Updated : 05 Oct, 2021

The HTML DOM Object vspace property is used to set or return the value of the vspace attribute of the object element. The vspace attribute is used to specify the number of whitespaces from the top and bottom sides of an object.  

Syntax

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

It returns the object vspace property.

objObject.vspace; 

It sets the object vspace property.



objObject.hspace="pixels".

Property Values: It contains the numeric value that represents the number of whitespaces from the top and bottom sides in terms of pixels. 

Example 1: This example returns the vspace property. 

HTML




<!DOCTYPE html>
<html>
  
<body>
    <center>
        <h2>GeeksforGeeks</h2>
  
        <h3>DOM Object vspace property</h3>
          
        <object id="myobject" width="180" height="78" vspace="50"
        </object>
  
        <p>A Good Platform for earning and learning.</p>
        <br>
  
        <button onclick="btnclick1()">
            Click it
        </button>
  
        <p id="paraID" style="color:green;font-size:25px;"></p>
  
    </center>
  
    <script>
        function btnclick1() {
          
            // Accessing Object element
            var x = document.getElementById("myobject").vspace;
            document.getElementById("paraID").innerHTML = x;
        }
    </script>
</body>
  
</html>

Output:             

Example 2: This example sets the object vspace property. 

HTML




<!DOCTYPE html>
<html>
  
<body>
    <center>
        <h2>GeeksforGeeks</h2>
  
        <h3>DOM Object vspace Property</h3>
          
        <object id="myobject" width="180" height="78" vspace="50"
        </object>
  
        <p>A Good Platform for earning and learning.</p>
        <br>
  
        <button onclick="btnclick1()">
            Click it
        </button>
  
        <p id="paraID" style="color:green;font-size:25px;"></p>
  
    </center>
  
    <script>
        function btnclick1() {
          
            // Accessing Object element
            var x = document.getElementById("myobject").vspace = "5";
            document.getElementById("paraID").innerHTML = x;
        }
    </script>
</body>
  
</html>

Output:

Note: It is not supported by HTML5.




My Personal Notes arrow_drop_up
Recommended Articles
Page :