Previous Next

Iframe Syntax

An HTML iframe is defined with the

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

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 use CSS to set the height and width of the iframe:

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 »

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

W3Schools.com

Try it Yourself »

HTML Exercises

Test Yourself With Exercises

Exercise:

Create an iframe with a URL address that goes to https://www.w3schools.com.

Start the Exercise

HTML iframe Tag

Tag Description