HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
An HTML iframe is used to display a web page within a web page
The HTML <iframe>
tag specifies an
inline frame.
An inline frame is used to embed another document within the current HTML document.
<iframe src="url" title="description"></iframe>
title
attribute for the <iframe>
.
This is used by screen readers to read out what the content of the iframe is.
Use the height
and width
attributes to specify the
size of the iframe.
The height and width are specified in pixels by default:
<iframe src="demo_iframe.htm" height="200" width="300"
title="Iframe Example"></iframe>
Or you can add the style
attribute and use
the CSS height
and width
properties:
<iframe src="demo_iframe.htm" style="height:200px;width:300px;"
title="Iframe Example"></iframe>
By default, an iframe has a border around it.
To remove the border, add the style
attribute and use the CSS
border
property:
<iframe src="demo_iframe.htm" style="border:none;"
title="Iframe Example"></iframe>
With CSS, you can also change the size, style and color of the iframe's border:
<iframe src="demo_iframe.htm" style="border:2px solid red;"
title="Iframe Example"></iframe>
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:
<iframe src="demo_iframe.htm" name="iframe_a" title="Iframe
Example"></iframe>
<p><a href="/" target="iframe_a">W3C</a></p>
<iframe>
tag specifies an
inline framesrc
attribute defines the URL of the page to embed
title
attribute (for screen readers)height
and width
attributes specify the
size of the iframeborder:none;
to remove the border
around the iframeCreate an iframe with a URL address that goes to /.
Tag | Description |
---|---|
<iframe> | Defines an inline frame |
For a complete list of all available HTML tags, visit our HTML Tag Reference.