HTML iframe example coding

An inline frame is used to embed another website page or document within the a current HTML page or document.

An frame is coded in the following manner:

<iframe src=”http://www.chameleonwebservices.co.uk”></iframe>

 

Attribute Value Description & Notes
align left

right

top

middle

bottom

Specifies the alignment of an <iframe> according to surrounding elements

This is not supported in HTML5. Deprecated in HTML 4.01.

frameborder 1

0

Specifies whether or not to display a border around an <iframe>

This is not supported in HTML5.

height pixels Specifies the height of an <iframe>
longdesc URL Specifies a page that contains a long description of the content of an <iframe>

This is not supported in HTML5.

marginheight pixels Specifies the top and bottom margins of the content of an <iframe>

This is not supported in HTML5.

marginwidth pixels Specifies the left and right margins of the content of an <iframe>

Not supported in HTML5.

name name Specifies the name of an <iframe>
sandbox “”

allow-forms

allow-same-origin

allow-scripts

allow-top-navigation

Enables a set of extra restrictions for the content in the <iframe>
scrolling yes

no

auto

Specifies whether or not to display scrollbars in an <iframe>

This is not supported in HTML5.

seamless seamless Specifies that the <iframe> should look like it is a part of the containing document
src URL Specifies the address of the document to embed in the <iframe>
srcdoc HTML_code Specifies the HTML content of the page to show in the <iframe>
width pixels Specifies the width of an <iframe>