The HTML5 iframe Tag

There are times when inserting or embedding another document within an HTML document is necessary. During such occasions, using HTML5 <iframe> tag is quite handy. The HTML5 <iframe> tag is the tool that is used for emphasizing and adding an inline frame.

The <iframe> tag is also used in HTML4.01. However, it has to be noted that using this tag in HTML4.01 and HTML5 is not the same. There are several new attributes that are added in HTML5. On the other hand, some of the ones used for HTML 4.01 are already considered obsolete and are not incorporated in HTML5.

Since some of the attributes in HTML4.01 is no longer used for HTML5, it is necessary to incorporate CSS techniques when adding style to the <iframe> tag. This is the standard for HTML5 even when it comes to adding scrollbars.

The attributes for the HTML5 <iframe> tag are the following:

Attribute

Value

Description

frameborder

1
0

This is no longer recognized or supported in HTML5

height

pixels

This determines what will be the height of the iframe that is used within the document

longdesc

URL

This is no longer recognized or supported in HTML5

marginheight

pixels

This is no longer recognized or supported in HTML5

marginwidth

pixels

This is no longer recognized or supported in HTML5

name

name

When providing a name for the iframe, this is what should be used

sandbox (NEW)

""
allow-forms
allow-same-origin
allow-scripts
allow-top-navigation

When the author of the document has to put restriction for the content within the iframe, this has to be added

scrolling

yes
no
auto

This is no longer recognized or supported in HTML5

Seamless (NEW)

seamless

This ensures that the iframe will not pop out from the rest of the document. It is the key in ensuring that the look of the iframe is patterned after all other parts of the HTML document

src

URL

It is the indicator as to where the iframe is embedded

srcdoc (NEW)

HTML_code

This enables the HTML document to identify which content within the page has to be incorporated in the iframe

width

pixels

It determines what the width of the iframe would be

The good thing about HTML <iframe> tag is that author would not have a hard time using it since it also supports both the Global Attributes and Events Attributes in HTML5. It is also compatible with the major web browsers that are commonly used in different computers and mobile devices these days like the Safari, Opera, Google Chrome, Internet Explorer and Firefox.

Featured pages

Overview

Learn about HTML5 architecture, design principles and patterns on HTML5 Overview Tutorial. Become …

Tags

Learn about HTML5 tags and discover a new list of HTML5 tags. Find out about HTML5 tags support by…

Welcome

 Learn HTML5 development techniques, tips and tricks on our website. Find out what is required…

Date Time Picker

HTML5 forms use date and time controls regularly. HTML5 date and time controls are used by booking …