W3Schools.com (original) (raw)

HTML Iframes


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



HTML Iframe Syntax

The HTML <iframe> tag specifies an inline frame.

An inline frame is used to embed another document within the current HTML document.

Syntax

Tip: It is a good practice to always include a title attribute for the <iframe>. This is used by screen readers to read out what the content of the iframe is.


Iframe - Set Height and Width

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

The height and width are specified in pixels by default:

Example

Try it Yourself »

Or you can add the style attribute and use the CSS height and widthproperties:

Example

Try it Yourself »



Iframe - Remove the Border

By default, an iframe has a border around it.

To remove the border, add the style attribute and use the CSS border property:

Example

Try it Yourself »

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

Example

Try it Yourself »


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

W3Schools.com

Try it Yourself »


Chapter Summary



HTML iframe Tag

Tag Description
Defines an inline frame

For a complete list of all available HTML tags, visit our HTML Tag Reference.


Video: HTML Iframe


★ +1

Track your progress - it's free!

Get Certified