Search On Google

Saturday, December 29, 2018

HTML iframes

What is iframe element?

An iframe is used to display a web page within a web page.

Syntax if iframe:-

<iframe src="URL"></iframe>

How to set Height and Width of Iframe?

Height and width attributes are given to set height and width of iframe.
<iframe src="demo_iframe.htm" height="200" width="300"></iframe>


You can set by style also.
<iframe src="demo_iframe.htm" style="height:200px;width:300px;"></iframe>


How to open a page in iframe by click?

You can open a link in i-frame also by writing target="iframe_name" in link.

Answer:-
Suppose we have a iframe as below name is=iframe_first
<iframe src="demo_iframe.htm" name="iframe_first"></iframe>

and below is link to have target attribute with value="iframe_first".
If we click on below link then page will be open in above iframe.

<p><a href="https://www.w3schools.com" target="iframe_first">W3Schools.com</a></p>


Try HTML Iframe Example in Editor

No comments:

Post a Comment

About Me

My photo
Mumbai, Maharashtra, India