Open In App

HTML DOM Iframe align Property

The HTML Iframe align property is used to set or return the value of the align attribute of the <iframe> element. 

Note: This property is not supported by HTML5.



Syntax:  

It returns the aligned property.



iframeobject.align;

It sets the aligned property.

Iframeobject.align="left|right|middle|top|bottom"

 

Property Values:

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

 Example 1: Below example illustrates how to return the Iframe align property.




<!DOCTYPE html>
<html>
  
<body style="text-align:center;">
  
    <h1>GeeksforGeeks</h1>
  
    <h2>
        HTML DOM iframe align Property
    </h2>
  
        id="iframeID" align="middle" 
        height="200" width="400">
    </iframe><br>
  
    <button onclick="click1()">Submit</button>
    <p id="paraID"></p>
  
      
    <script>
        function click1() {
            var x = document.getElementById("iframeID").align;
            document.getElementById("paraID").innerHTML = x;
        }
    </script>
</body>
  
</html>

Output:

Example 2: Below example sets the iframe alignment property to right. 




<!DOCTYPE html>
<html>
  
<body style="text-align:center;">
  
    <h1>GeeksforGeeks</h1>
  
    <h2>
        HTML DOM iframe align Property
    </h2>
  
        id="iframeID" align="middle" 
        height="200" width="400">
    </iframe><br>
  
    <button onclick="click1()">Submit</button>
    <p id="paraID"></p>
  
  
    <script>
        function click1() {
            var x = document.getElementById(
                    "iframeID").align = "right";
                      
            document.getElementById("paraID").innerHTML = x;
        }
    </script>
</body>
  
</html>

Output:

List of Supported Browsers:


Article Tags :