w3resource

HTML iframe tag and element

HTML iframe element is used to include a web document within another web document.

Syntax

<iframe src="document" ></iframe>

Whether both start and end tags are required

Yes.

Can contain

HTML iframe element can contain inline elements and other block level elements.

Can reside within

HTML iframe element can reside within block level elements.

Attributes

longdesc, name, width, height.

Identifiers

id, class.

language information and text direction

lang, dir.

Title

Title.

Style

Style.

Frame controls and decoration

name, src, frameborder, marginwidth, marginheight, scrolling.

align

align attribute defines the alignment of text written within a p element. Values may be left for aligning the text left, right for aligning the text right and center for aligning the text center.

Events

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.

Supported doctypes

HTMl 4.01 transitional.

Example of using HTML iframe element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML iframe tag example - HTML tutorial | w3resource</title>
</head>
<body>
<iframe src="iframe.html">
</iframe>
</body>
</html>

Result

html iframe element

View this example in a separate browser window

HTML iframe tag example.

Previous: HTML noframes tag and element
Next: HTML form tag and element

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/html/iframe/HTML-iframe-tag-and-element.php