HTML Iframes

<Iframe> tag is used to define inline frame within our web page, it’s not related to the frameset tag and can define anywhere in the webpage.

Syntax:

<iframe src=”WEB_PAGE_URL”></iframe>

Example:

<html>
<body>
<iframe src=”iFrameEx.html”></iframe>
</body>
</html>

Iframe – Size

With the help of width and height attribute, we can manage the size of iframe

Example:

<html>
<body>
<iframe src=”iFrameEx.html” width=”500″ height=”150″ ></iframe>
</body>
</html>

Iframe – Target

We can use name attribute of iframe to indicate which frame a document should be loaded. This is useful when you want to create a link in one frame that load page into another frame.

Example:

<html>
<body>
<iframe src=”iFrameEx.html” name=”my_iframe” ></iframe>
<p><a href=”http://www.bestonetechnologies.com” target=”my_iframe”>bestonetechnologies.com</a></p>
</body>
</html>

In the above example, when we click on the link, “bestonetechnologies” page will be display in a frame.

Output:

Leave a Reply