Open In App

HTML | DOM Object align Property

The HTML DOM Object align property is used to set or return the value of the data attribute of an element.

Note: This property is not supported by HTML5



Syntax: 

objectobject.align;
objectobject.align="left | right | middle | top | bottom"

Property Values:



Return Values: It returns a string value that represents the alignment of the object element. 

Example 1: This example returns the object align property.




<!DOCTYPE html>
<html>
<head>
    <title>
        HTML DOM Object align Property
    </title>
</head>
<body>
    <object id="myobject" data="HelloGeeks.swf"
        width="400" height="100" align ="center"
        form="myGeeks" data=
    </object>
    <br><br><br>
    <h2 align ="left">DOM Object align Property</h2>
    <button onclick="Geeks()">
        Click it
    </button>
    <p id="gfg" style=
        "color:green; font-size:25px;">
    </p>
 
    <script>
        function Geeks() {
 
            // Return Object align Property
            var x =
                document.getElementById(
                    "myobject").align;
 
            document.getElementById(
                "gfg").innerHTML = x;
        }
    </script>
</body>
</html>

Output: 

Example 2: This example sets the object to align property 




<!DOCTYPE html>
<html>
<head>
    <title>
        HTML DOM Object align Property
    </title>
</head>
<body>
    <object id="myobject" data="HelloGeeks.swf"
        width="400" height="100" align ="center"
        form="myGeeks" data=
    </object>
    <br><br><br>
    <h2 align ="left">DOM Object align Property</h2>
    <button onclick="Geeks()">
        Click it
    </button>
    <p id="gfg" style=
        "color:green; font-size:25px;">
    </p>
 
    <script>
        function Geeks() {
  
            // set Object align Property
            var x = document.getElementById(
                    "myobject").align = "left";
  
            document.getElementById(
                    "gfg").innerHTML = x;
        }
    </script>
</body>
</html>

Output: 

Supported Browsers: The browsers supported by DOM Object align Property are listed below: 


Article Tags :