Open In App

HTML DOM Marquee hspace Property

Improve
Improve
Like Article
Like
Save
Share
Report

The HTML DOM Marquee hspace Property is used to set or return the value of the hspace attribute. The hspace attribute is used to specify the horizontal margin around the marquee element.

Syntax:

  • It returns the marquee hspace Property.

    marqueeObject.hspace; 
  • It sets the marquee hspace Property.

    marqueeObject.hspace = "px/%"

Property Values:

  • px: It specifies the horizontal space around the marquee.
  • %: It specifies horizontal space around the marquee.

Return Value: It returns a numeric value that represents the number of horizontal margin around the marquee Tag.

Note: The <marquee> hspace Attribute is not supported in HTML 5.

Example: Below HTML code helps to return the marquee hspace Property.

HTML




<!DOCTYPE html>
<html>
  
<body style="text-align:center;">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h2>DOM Marquee hspace Property</h2>
  
    <marquee id="marqueeID" direction="right"
            loop="3" bgcolor="green"
            hspace="25%">
        GeeksforGeeks:A computer Science
        Portal for Geeks
    </marquee>
    <br><br>
  
    <button onclick="btnClick()">
        Return hspace property
    </button>
    <p id="sudo"></p>
  
    <script>
        function btnClick() {
            var txt = document.getElementById(
                "marqueeID").hspace;
  
            document.getElementById("sudo")
                .innerHTML = txt + "%";
        }
    </script>
</body>
  
</html>


Output:

HTML DOM Marquee hspace Property

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera


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