HTML: Iframe

By Xah Lee. Date: . Last updated: .

“Iframe” is used to embed another page's content in the current page, and it can also be used for a scrollable window inside a window.

HTML5

“iframe” is supported in html5.

[see HTML5 Tags Complete List]

Here's a iframe sample:

Here's the code:

<iframe src="xyz.html" width="200" height="300"></iframe>

To controll iframe appearance, use CSS. See:

CSS: OverFlow, Scrollbar

HTML 4.01 transitional

If you are using {HTML 4.01 transitional, XHTML 1.1 transitional}, you can use “iframe”, like this:

<iframe src="some.html"
 longdesc="iframe_longdesc.html"
 width="200"
 height="200"
 align="top"
 frameborder="1"
 scrolling="auto">
For browsers that doesn't support iframe, this text is displayed.
</iframe>
AttributesValues
srcsource url
namea name string for the frame
longdesca url
widthpixels
heightpixels
alignOne of: top, middle, bottom, left, right
frameborder1 or 0
marginwidthpixels
marginheightpixels
scrollingyes, no, auto

HTML 4.01 Strict

“Iframe” tag is not supported in HTML 4.01 Strict nor XHTML 1.1 Strict.

However, all browsers supports it anyway.

To be technically correct, you can use “object” tag. See:

HTML: using “Object” tag for “Iframe”

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS Basics
  4. JS in Depth
  5. JS Reference
  6. DOM
  7. SVG
  8. JS Misc