Iframe

An iframe (short for inline frame) is an HTML element that allows an external webpage to be embedded in an HTML document. Unlike traditional frames, which were used to create the structure of a webpage, iframes can be inserted anywhere within a webpage layout.

An iframe can be inserted into an HTML document using the iframe tag, as shown in the example below:

<iframe src="http://sharpened.com/example.php" width="728" height="90"></iframe>

The code above would insert the contents of the URL into a 728 x 90 px inline frame within the webpage. The iframe source (src) can reference an external website or another page on the same server, such as src="/example.php". The width and height attributes are not required, but are commonly used to define the size of the iframe. Other iframe attributes, such as marginwidth and marginheight are supported in HTML 4 and earlier, but in HTML5, CSS is used to customize the appearance of an iframe.

Iframes are used for several different purposes, such as online advertising and multimedia. Many ad platforms use iframes to display ads on webpages since they provide more flexibility than an inline script. Since iframes may contain an entire webpage, advertisers can include extra tracking code within an iframe that helps ensure accurate reporting for both the advertiser and publisher.

Iframes are also used for displaying different types of media within a webpage. For example, YouTube videos and Google Maps windows are often embedded in webpages using iframes. Many web applications use iframes since they can display dynamic content without reloading the webpage.

Updated April 15, 2015 by Per C.

quizTest Your Knowledge

Which HTTP error code represents a "Forbidden" error?

A
400
0%
B
403
0%
C
404
0%
D
408
0%
Correct! Incorrect!     View the 403 Error definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of Iframe on this page is an original definition written by the TechTerms.com team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of TechTerms.com is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.