HTML <iframe> tag
Iframe is known as inline frame. It allows us to present a web page within same web page.
Note/Info Some browsers do not support iframes.
It is better to add a fallback content like this-
"Your browser does not support iframes. Please update your browser".
This fallback content will be displayed only when the browser does not support iframes.
It is better to add a fallback content like this-
"Your browser does not support iframes. Please update your browser".
This fallback content will be displayed only when the browser does not support iframes.
Syntax:
<iframe src=”URL”></iframe>
Example
<iframe src="https://www.tutorialbrain.com/"> <p>Your browser does not support iframes.</p> </iframe>
How Browser will display
BLOCK Level.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
NA | NA | New attribute were added for <iframe> tag but few attributes were also deprecated. |
Attributes used with <iframe> tag
Attribute | Description |
---|---|
height | Sets the height of the <iframe> in pixels. |
name | Set the name of the <iframe> using a text. |
sandbox | Adds other restrictions to the content of the <iframe>. This can take any of these values - |
src | Defines the URL of the source document of the <iframe>. |
srcdoc | This defines the HTML content of the page to show in the <Iframe> using an HTML_Code. |
width | Sets the width of the <iframe> in pixels. |
align | To align the iframe with respect to its nearby elements. The alignment can be - top, right, bottom, left or middle. (HTML5 does not support this attribute when it is used with the <iframe> tag). |
frameborder | This is a boolean attribute which can either take a value of 0 or 1. This decides whether to show a border around the iframe or not. (HTML5 does not support this attribute when it is used with the <iframe> tag). |
longdesc | Defines a URL to show a page containing a long description about the content of the <iframe>. (HTML5 does not support this attribute when it is used with the <iframe> tag). |
marginheight | Shows top and bottom margin for the content of the <iframe> using pixels. (HTML5 does not support this attribute when it is used with the <iframe> tag). |
marginwidth | Shows left and right margin for the content of the <iframe> using pixels. (HTML5 does not support this attribute when it is used with the <iframe> tag). |
scrolling | To decide if the scrollbar will appear for <iframe> or not. It can take following values - (HTML5 does not support this attribute when it is used with the <iframe> tag). |
Global Attributes
The <iframe> tag supports Global attributes.
Event Attributes
The <iframe> tag supports Event attributes.
Default CSS Value
display: block;
Supporting Browsers
Related Tags
None