Versión en español




HTML iframe tag


Note: If you don't know what a tag is and/or how you must use it we recommend you to read our HTML tags and attributes tutorial that you can find in our HTML tutorials section.

Description

The HTML iframe tag allow authors to insert a frame inside a document. It works similar to the HTML frame tag but the HTML iframe tag can be inserted in between the document's content.

The HTML iframe tag is inserted inside the text just like a table and is rendered as a windows containing the HTML document.

In the following example, the iframe is defined to show another document, and a link is defined for browser that don't support iframes.

Code begin <iframe width="100%" height="150" src="http://www.htmlquick.com/reference/tags/a.html" frameborder="1">
If you see this message, it means that your browser don't support this feature or it's disabled. But you can access to this information here <a href="http://www.htmlquick.com/reference/tags/a.html">HTML a tag</a>.
</iframe>Code end


Note that iframes can't be resized, so there's no need for the "noresize" attribute (like in the HTML frame tag).

Attributes

id (name)

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.

Example:

Code begin <p id="paragraph1">This is the first paragraph named as paragraph1. To dynamically change its properties use this identifier.</p>Code end


class (cdata)

The "class" attribute assigns a class name (or a list of class names separated by spaces) to the container element. It's used with style sheets and tells the browser the class to which the element is associated with. A class gives visual attributes to elements.

Example:

Code begin <p class="references">This article is based on the book "Wind in the trees" by Jhon L. Brooks</p>

<p class="references important">This article is based on the book "Wind in the trees" by Jhon L. Brooks... and is more important than the one before.</p>Code end


style (style)

Defines a visual style of this element. Is a better practice to define styles attributes in external style sheets grouping them in classes. Attributes in the "style" parameter must preserve this order "name : value" and be separated by a semi-colon.

If you're writing XHTML code it's recommended not to use this attribute and try style sheet classes (with the "class" attribute).

Example:

Code begin <p style="color: #0000FF; font-size: 12pt">This is a paragraph with a defined style</p>
<p>And this is another text without style.</p>Code end


title (text)

Indicates a title for the element. Used to give a short description about the element that is usually shown as a "tool tip" when the user put the mouse pointer over the element.

Example:

Code View
<a title="HTMLQuick.com" href="http://www.htmlquick.com">HTML code</a> HTML code

name (cdata)

Assigns a name to the frame. This name may be used as the value of the "target" attribute in links and forms. It's recommended to use the "id" attribute instead for XHTML code compatibility.

longdesc (uri)

Defines the address of a resource providing a description for this frame. It's supposed to supplement the short description provided in the "title" attribute.

Example:

Code begin <frame name="articles" src="articles-index.html" longdesc="whats-articles-frame.html">Code end


src (uri)

This attribute defines the address of the initial content for the frame.

Example:

Code begin <frame name="menu" src="menu.html">Code end


scrolling

Decides how scrolling devices will be shown for this frame. Possible values are (case-insensitive):

frameborder

Decides if a border (separator) will be drawn for this frame. The value "1" tells the browser to draw a border for this frame, while the value "0" not to draw it. Note that for two adjacent frames, both "frameborder" attributes must be set to "0" if you want the border between them to be invisible.

marginwidth (pixels)

Specifies the distance between the left margin and the content, as well as the distance between the right margin and the content.

marginheight (pixels)

Specifies the distance between the top margin and the content, as well as the distance between the bottom margin and the content.

width (length)

Assigns a width to the element.

height (length)

Assigns a height to the element.

align

This attribute have been deprecated

Specifies the horizontal alignment of its element. Possible values are (case-insensitive):


Events

There are no events defined for this tag.

See complete list and information about events in HTML




Bypass footer options  |   Send to a friend Send to a friend  |  Post to del.icio.us Post to del.icio.us

Digg this page Digg this!  |  File on Furl File on Furl  |  Add to Yahoo! MyWeb Add to Yahoo! MyWeb

Bypass W3C declarations | 

Valid XHTML 1.0 Strict  |  Valid CSS Why should you trust us? Click the images on the left to see how seriously we write our own pages, then make your choice.

Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0. This website gives its best effort to achieve the Level Triple-A Conformance, W3C-WAI Web Content Accessibility Guidelines 1.0. If you find any detail or error that we didn't see, don't hesitate and let us know.

The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. -- Tim Berners-Lee, W3C Director and inventor of the World Wide Web.

 Link to us  |  Contact us  |  Beyond HTML  |  Tools and resources  |  Sitemap  |  Webmaster