htmlcss

The HTML <iframe></iframe> element creates an inline frame that contains another document. Use CSS to style this element, even to include scrollbars.


Attributes

Attribute Value Description
frameborder 1
0
Deprecated
height pixels
%
Defines the height.
longdesc URL Deprecated
marginheight pixels Deprecated
marginwidth pixels Deprecated
name framename Specifies a unique name.
sandbox allow-forms
allow-same-origin
allow-scripts
Defines restrictions to the frame content.
scrolling yes
no
auto
Deprecated
seamless seamless If present, the <iframe> should appear as if it is part of the document it is in.
src URL The URL of the document to show in the frame.
srcdoc HTML The HTML of the document showing in the frame.
width pixels
%
Defines the width.


HTML example:

<iframe src="http://www.wwf.org"></iframe>


Live inline frame example:

This is a live example of an inline frame. The Facebook like box is rendered using the <iframe> element. You can view the source code below:

Source code for the Facebook like box. Notice the inline frame element.

Source code for the Facebook like box. Notice the inline frame element.