Note: If you don't know what an element/tag is and/or how you must use it we recommend you read our HTML tags and attributes tutorial, which you can find in our HTML tutorials section.
Table of contents
Bypass table of contentsThe HTML iframe element inserts a frame inside a document. This frame works almost exactly as the HTML frame element, except that the last can only be inserted in a frameset (HTML frameset element). This is useful for displaying a document in a portion of another document.
The document displayed inside this inline frame, is specified in the "src" attribute. For user agents not supporting frames, the content serves as alternative version of the document, reason for which it is a good practice to explain and provide a link to the content that's supposed to be loaded in the frame.
In XHTML 1.0 the "name" attribute for this element has been deprecated in favor of the "id" attribute. On the other hand, the "align" attribute was deprecated in HTML 4.01. Therefore, their use is no longer recommended.
In the following example, the HTML tutorials section is displayed in an inline frame. An alternative version is set as content of the element to be displayed when support for frames is absent.
The "id" attribute assigns an identifier to the associated element. This identifier must be unique in the document and can be used to refer to that element in other instances (e.g., from client-side scripts).
The "class" attribute assigns a class name (or a list of class names separated by spaces) to the container element. It is used together with style sheets and tells the browser the class (or classes) to which the element is associated with.
A class gives presentational attributes to elements (read more at the Cascading Style Sheets tutorial).
This attribute is used to define presentational attributes for the containing element, and its value should be composed by style sheets properties. Although in some cases it can become useful, a better practice is to place presentational attributes in external files, relating them to elements with the "class" attribute. This way you keep the semantic and presentational parts of your document separated.
You can find more information about presentational attributes at the Cascading Style Sheets tutorial.
The purpose of this attribute is to provide a title for the element. Its value must be a short and accurate description of the element. Browsers usually render it as a "tool tip" when the user puts the mouse pointer over the element for a short period of time.
This attribute points to the document that will be initially loaded in the frame (when the documento is loaded).
Points to a resource with an extended description for the frame purpose. It is supposed to supplement the information provided in the "title" attribute.
Decides how scrolling devices will be shown for this frame. Possible values (case-insensitive) are:
Decides if a border (separator) will be drawn for this frame. The value "1" tells the browser to draw a border for this frame; the value "0" not to draw it.
Sets the distance between the content of the frame and the left or right margin.
Sets the distance between the content of the frame and the top or bottom margin.
Sets the distance between the left and right borders.
Sets the distance between the top and bottom borders.
Its value acts as an identifier for the frame, which can be used in links and forms as value of the "target" attribute.
In XHTML 1.0 the "name" attribute for this element has been deprecated in favor of the "id" attribute and in XHTML 1.1 it's simply invalid. Therefore, its use is no longer recommended.
This attribute has been deprecated in HTML 4.01. Therefore its use is no longer recommended.
It defines the horizontal alignment of its content. Possible values (case-insensitive) are:
This element doesn't suppot events.
See a complete list and information about events in HTML
Diseño y desarrollo: Latitud29.com