Open In App

HTML DOM Marquee height Property

Last Updated : 15 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML DOM Marquee height Property is used to set or return the value of the height attribute of the <marquee> element.

Syntax:

It returns the marquee height property.

marqueeObject.height

It sets the marquee height property.

marqueeObject.height="px/%"

Note: This property is depreciated from HTML 5.

Property Values:

  • px: It defines the height value of the marquee.
  • %: It defines the height value of the marquee.

Return Value : It returns a numeric value that represent the height of the <marquee> element in terms of pixel

Example 1: Below HTML code returns the marquee height property.

HTML




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


Output:

HTML DOM Marquee height Property

Example 2: Below HTML code sets the marquee height property.

HTML




<!DOCTYPE html>
<html>   
    <body style="text-align:center;">
     
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
         
        <h2>DOM Marquee height Property</h2>
         
        <marquee id="marqueeID" direction="right"
         behavior="slide" loop="3"
         bgcolor="green" height="40px">
            GeeksforGeeks:A computer Science
            Portal for Geeks
        </marquee>       
        <br><br>
         
        <button onclick="btnClick()">
          Change height of Marquee Tag
        </button>
              <p id ="sudo"></p>
 
 
        <script>
            function btnClick() {
                var txt = document.getElementById(
                    "marqueeID").height = "20px";
     
                document.getElementById(
                    "sudo").innerHTML = txt;
            }
        </script>   
    </body>
</html>


Output:

HTML DOM Marquee height Property

Supported Browsers:

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads