HTML <iframe> alignAttributes

HTML iframe 标签参考手册HTML <iframe> Tag

Examples

A right-aligned <iframe>:

<iframe src="../index.html" width="200" height="200" align="right">
</iframe>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Although the align attribute is deprecated, it is still supported by all major browsers.


Definition and Usage

HTML5 does not support the <iframe> align attribute. Use CSS instead.

In HTML 4.01, the align attribute of <iframe>is deprecated.。

The align attribute specifies the alignment of the <iframe> relative to surrounding elements.

The <iframe> element is an inline element (it does not insert a new line on the page), which means text and other elements can surround it. Therefore, the align attribute helps us specify the alignment of the <iframe> relative to surrounding elements.


Compatibility Notes

In HTML 4.01, the align attribute of <iframe> is deprecated. Use CSS instead.

CSS syntax: <iframe style="float:right">

CSS Example: Float the iframe to the right

In our CSS tutorial, you can find more about thefloat propertyin detail.


Syntax

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

Attribute Values

Value Description
left Left-aligns the iframe.
right Right-aligns the iframe.
middle Center-aligns the iframe.
top Aligns the iframe at the top.
bottom Aligns the iframe at the bottom.


HTML iframe 标签参考手册HTML <iframe> Tag Other Extensions