Advertisement
❮ Previous: HTML Id Next: HTML CSS ❯

HTML Iframe

An HTML iframe is used to display a web page within a web page. You can define an inline frame with HTML tag <iframe>. The <iframe> tag is not somehow related to <frameset> tag, instead, it can appear anywhere in your document.

Example

<iframe src="demo.html" title="demo" width="300" height="600" scrolling="auto">
  Your browser does not support frames.
</iframe>

Try this code ❯


Syntax

<iframe src="URL" width="pixels" height="pixels" scrolling="auto|no|yes">
Sorry, your browser doesn't support inline frames.
<iframe>

Note: If a browser doesn't support an <iframe> tag, it displays the text within it.


Advertisement

HTML Iframe - Set Height and Width

You can use the height and width attributes to specify the size of the iframe. By default width is 300px and height is 150px.

This example shows how to set height and width are specified in pixels by default:

Example

<iframe src="demo.html" title="demo" width="300" height="600" scrolling="auto">
  Your browser does not support frames.
</iframe>

Try this code ❯

This example shows how to set height and width properties using style attribute and use the CSS:

Example

<iframe src="demo.html" title="demo" style="width:300;height:600;">
  Your browser does not support frames.
</iframe>

Try this code ❯

A complete list of all HTML tags, see HTML Tag Reference.

❮ Previous: HTML Id Next: HTML CSS ❯
Advertisement