HTML Page Structure

HTML Elements
HTML Attributes


HTML IFrame Tag

HTML IFrame Tag is an abbreviation of In-Line Frames which is used to embed one HTML document inside another HTML document. It is generally used to overcome the disadvantages of using Frames. It is also used for displaying advertising content or for the purpose of comparing two or multiple HTML documents.

Web programmers can change frame contents through IFrame using client side scripting language like JavaScript without requiring the website to be reloaded.You can even embed a video on your site and that other webpage of video will not appear as a full webpage but will look like it is a part of your page.

Why IFrames?

  • Used for inclusion of external objects inclusing HTML documents.
  • It helps improving performance of website.
  • IFrame works even if Javascript is disabled in any computer.
  • Used to insert contents such as an advertisement, into a Web page.
  • IFrame givens more security to advertisers.

Disadvantages of using IFrames

  • It lowers your Search Engine Optimization score.
  • Performace isnot upto the mark.
  • Some browsers do not support iframes.

HTML IFrame Example

This will produce following result

HTML IFrame Attributes List

The below table contains HTML IFrame Attributes and their description which is supported by HTML version.

Attribute NameAttribute ValueAttribute Description
srcURLrefers to the url of the document to be loaded into the iframe
heightpixelsrefers to the height of an iframe
widthpixelsrefers to the width of an iframe
aligntop,middle,bottom,left,rightrefers to the the alignment of an iframe with respect to surrounding elements
marginheightpixelsrefers to space to be left at the top and bottom sides of the iframe
marginwidthpixelsrefers to space to be left along the sides of the iframe
nametextrefers to a name for the iframe
scrollingpixelsrefers to to decide whether to have scrollbarsin a iframe
longdescURLrefers to URL to the document containing long description of the iframe
frameborderpixelsrefers to whether borders of the iframe are shown