Summary -
In this topic, we described about the iframes along with detailed example.
Nested browsing context or inline frame. The <iframe> used to represent inline frame. The inline frame allows embedding one HTML document in another HTML document.
The tag can be specified like <iframe src=""></iframe> with the URL of the embedded document in between the opening/closing quotes.
Syntax -
<iframe>.. text here.. </iframe>
Optional Attributes -
Attribute | Description | Values |
---|---|---|
align | Specifies the alignment of the <iframe>Not supported in HTML5. | LeftRightTopBottom |
Frameborder | Specifies the border display needed or not.Not supported in HTML5. | 01 |
Height | Specifies the height of <iframe> | Pixels |
Marginheight | Specifies the top and bottom margins of the iframe.Not supported in HTML5. | Pixels |
Marginwidth | Specifies the left and right margins of the iframe.Not supported in HTML5. | Pixels |
Name | Specifies the name of the iframe | Text |
sandbox | Specifies a set of restriction to the content of <iframe>.Newly added in HTML5. | allow-formsallow-pointer-lockallow-popupsallow-same-originallow-scriptsallow-top-navigatio |
Scrolling | Specifies frame defined is scrollable or notNot supported in HTML5. | Auto NoYes |
src | Specifies the address of the webpage embedded. | URL. |
srcdoc | Specifies the HTML content code to show in <iframe>.Newly added in HTML5. | HTML. |
width | Specifies the width of the <iframe> | Pixels |
Example -
<!DOCTYPE html>
<html>
<head>
<title>Italic text example.. </title>
</head>
<body>
<iframe src="https://www.tutorialscampus.com" width="100%" height="450">
<p>Browser does not support iframes.</p>
</iframe>
</body>
</html>