Open In App

HTML DOM Marquee hspace Property

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:



Property Values:

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.




<!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:


Article Tags :