IFrame alignProperty

Frame/IFrame 对象参考手册Frame/IFrame Object

Definition and Usage

The align property sets or returns the value of the align attribute of the iframe element.

The align property specifies how to align the iframe according to the surrounding text.

Tip: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 iframe can be aligned according to the surrounding text.

Syntax

iframeObject.align=value

The align property can take the following values:

Value Description
left Left-aligns the iframe
right Right-aligns the iframe
middle Center-aligns the iframe
top Top-aligns the iframe
bottom Bottom-aligns the iframe


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the align property.


Example

Example

Right-align the iframe:

document.getElementById("myframe").align="right";

Try it yourself »


Frame/IFrame 对象参考手册Frame/IFrame Object Other Extensions