HTML Iframe

in iframe •  7 years ago 

images (4).jpeg

HTML Iframe

an iframes is used to display a web page within a web page.



Iframes syntax

an HTML iframe is defined with the <iframe> tag:


<iframe src="url"></iframe>

the src attribute specifies the URL (web address) of the inline iframe page.


Iframe - set Height and Width

Use the height and width attributes to specify the size of the iframe.


The attribute values are specified in pixel by default, but they can also be in percent (like "85%").


example

<iframe src="demo_iframes.htm" height="200" width="300"></iframe>

Or you can use Css to set the height and width of the iframe:


example

<iframe src="demo.htm" style="height:200px;width:300px;"></iframe>

Iframe - Remove the Border

By default, an iframe has a border around it.


To remove the border, Add the style attributes and use the CSS border property:


Example

<iframe src="iframe.htm" style="border:none;"></iframe>

With CSS, you can also change the size, style and color of the iframe's border:


Example

<iframe src="iframes.htm" style="border:2px solid red;"></iframe>

 

Iframe - Target for a Link

An iframe can be used as the target frame for a link.


The target attribute of the link must refer to the name attribute of the iframe:


Example

<iframe src="sd.htm" name="iframe_a"></iframe>


<p><a href="#" target="iframe_a">#</a></p>

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

This post has received a 1.56 % upvote from @drotto thanks to: @rabiul21.