HTML IFrames

HTML Tutorial

HTML Forms

HTML Graphics

HTML Media

HTML API

HTML Iframes

The HTML <iframe> tag denotes an inline frame.

An inline frame embeds another document within the current HTML document.

Syntax

<iframe src=”url” title=”description”></iframe>

The height and width attributes specifies the size of the iframe.

By default, the height and width are specified in pixels:

you can also use the CSS height and width properties

Example

				
					<p>You can use the height and width attributes to specify the size of the iframe:</p>
<iframe src="demo_iframe.htm" height="200" width="300" title="Iframe Example"></iframe>

				
			

Iframe – Remove the Border

An iframe has a border around it by default.

Adding the style attribute and using the CSS border property removes the border:

				
					<iframe src="demo_iframe.htm" style="border:none;" title="Iframe Example"></iframe>
				
			

With CSS, you can also change the size, style and color of the iframe’s border:

				
					<iframe src="demo_iframe.htm" style="border:2px solid red;" title="Iframe Example"></iframe>
				
			

Iframe – Target for a Link

An iframe target’s frame for a link.

The target attribute of the link must be used to denotes the name attribute of the iframe:

Example

				
					<iframe src="demo_iframe.htm" name="iframe_a" height="300px" width="100%" title="Iframe Example"></iframe>