Open In App

HTML DOM Object vspace Property

Improve
Improve
Like Article
Like
Save
Share
Report

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

It returns the object vspace property.

objObject.vspace; 

It sets the object vspace property.

objObject.vspace="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() {
         
            // return Object vspace property
            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() {
         
            // set object vspace property
            var x = document.getElementById("myobject").vspace = "5";
            document.getElementById("paraID").innerHTML = x;
        }
    </script>
</body>
</html>


Output:

Note: It is not supported by HTML5.



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