Open In App

HTML <iframe> align Attribute

Last Updated : 05 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <iframe> align attribute is used to specify the alignment of the inline-frame according to the alternate element. 

Syntax

<iframe align="left|right|middle|top|bottom">

Attribute Values

  • left: It sets the alignment of an iframe to left.
  • right: It sets the alignment of an iframe to right.
  • middle: It sets the alignment of an iframe to the middle.
  • top: It sets the alignment of an iframe to the top.
  • Bottom: It sets the alignment of an iframe to the bottom.

Note:

The HTML <iframe> align Attribute is not supported by HTML5.


Example: Below HTML code demonstrates the use of align attribute in the <iframe> element. 

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML iframe align Attribute
    </title>

    <style>
        .left {
            text-align: left;
        }

        .right {
            text-align: right;
        }
    </style>
</head>

<body style="text-align:center;">

    <h1>GeeksforGeeks</h1>

    <h2>HTML iframe align Attribute</h2>
    <b>
        <p class="left">left-align</p>

    </b>

    <iframe align="left" src=
"https://www.geeksforgeeks.org/community/"
        height="200" width="250">
    </iframe>
    <b>
        <p class="right">right-align</p>

    </b>

    <iframe align="right" src=
"https://ide.geeksforgeeks.org/index.php" 
        height="200" width="250">
    </iframe>
</body>

</html>


Supported Browsers: 

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

Similar Reads