Computing Magazine

Iframe

Posted on the 19 January 2014 by Savio Menezes

This tutorial will teach you how to use inline frames in a web page. Iframe is used to display a web page within a web page. The syntax for iframe is: <iframe src=”url”></iframe>
Example 
<iframe src="http://saviosteaching.blogspot.in/2013/12/images.html" width="300" height="400"></iframe>
Output
Note: width and height attributes of <iframe> specify width and height of iframe respectively. By default width and height are mentioned in pixels but you can also specify in percent.
Borderless iframe If you want borderless iframe then put frameborder=”0” in <iframe> i.e. <iframe src=”address” frameborder=”0”></iframe>
Example
<iframe height="400" src="http://saviosteaching.blogspot.in/2013/12/images.html" width="300" frameborder ="0"></iframe>
Output
How to open another web page in iframe? This can be done using target attribute of <a>. Note that value of target attribute should be same as name attribute value of iframe.
Example
<a href="http://saviosteaching.blogspot.in/2013/12/colors.html" target="another">Open colors web page</a><br /><br />
<iframe name="another" src="http://saviosteaching.blogspot.in/2013/12/images.html" width="300" height="300" ></iframe>
Output  Open colors web page


Back to Featured Articles on Logo Paperblog

Magazines