HTML iframe


HTML HTML iframe Iframe Example

What is iframe?

An element that is used to display external objects including other web pages within a web page.

Example:-

<iframe src="https://codingpk.com" width="100%" height="350"> </iframe>

Output:-

Iframe Syntax

<iframe scr="url"></iframe>==

url is the address of web page that you want to display in current page.

Setting Iframe Size

The width and height attributes are used to set size of an iframe.

Example:-

<iframe src="https://codingpk.com" width="70%" height="300"> </iframe>

Note: By default value is in pixels but we can also set in percentage.(e.g 70%

Output:-

Remove Iframe Border

You can remove iframe border by style attribute.

Example:-

<iframe src="https://codingpk.com" style="border:none;" width="70%" height="300"> </iframe>---

Note:- By Default an iframe has border but you can remove it. You can also set border of your own choice in style attribute.

Iframe as Link Target

An iframe can be used as the target frame for a link. An iframe can be named using the name attribute. This implies that when a link with a target attribute with that name as value is followed, the linked resource is opened in the iframe.

.

Example:-

<iframe src="https://codingpk.com"" name="Show-Frame" width="100%" height="300"></iframe><p> <a href="https://codingpk.com/Post/Tutorial/learn_html_in_short_cource" target="Show-Frame"" target="Show-Frame">Html Page iframe in current iframe</a></p>

Output:-

Html Page iframe in current iframe

HTML Iframe Example Chapter Next »