Iframes


Iframes

An inline frame can be defined using HTML <iframe> tag. If you want to embed one document inside another HTML document then an iframe can be used. It creates a rectangular region inside the document. With the help of scroll bars, the content inside an iframe can be viewed.

The <iframe> element has nothing to do with the <frameset> tag and can occur anywhere on your page. A nested webpage is shown using an HTML iframe (a webpage within a webpage). The <iframe> tag in HTML defines an inline frame, which is also known as an inline frame. JavaScript allows the content of the webpage and the contents of the iframe to interact with one another.

Height and Width:

The iframe's size is determined by the height and width properties. The attribute values are supplied in pixels by default, although percentages can also be used.

Removing Border:

iframes have a border around them by default. We must utilise the style attribute and the CSS border property to remove the border.

Border Style:

Changing the iframe's border size, style, and colour.

Link:

An iframe can be used as the link's target frame. The link's target attribute must relate to the iframe's name attribute.

Example No.1:

<html> <body> <h2>Knowledge1life</h2> <iframe src="demo_iframe.htm" height="200" width="300" title="Iframe Example"></iframe> </body> </html>

OUTPUT:

Knowledge1life

Example No.2:

<html> <body> <h2>HTML Iframes</h2> <p>You can also use the CSS height and width properties to specify the size of the iframe:</p> <iframe src="demo_iframe.htm" style="border:none; style="height:200px;width:300px" title="Iframe Example"></iframe> </body> </html>

OUTPUT:

HTML Iframes

You can also use the CSS height and width properties to specify the size of the iframe: