Thursday, January 6, 2011

Inline Frames

Inline Frames, specified by the iframe element allow one to display files within an (X)HTML document. The inserted file can be another (X)HTML document or an image or text file etc. The inserted file, specified by the src attribute, is displayed in a rectangular frame.

iframe is an inline replaced element. It is also a flow element, therefore it can have block or inline child elements. The child elements and/or text content of the Inline Frame are displayed by browsers that do not support Inline Frames.

Only the transitional doctypes allow Inline Frames.

Attributes

Core Attributes
The core attributes can be applied to this element.
align
This is a deprecated attribute. It specifies the alignment of the Inline Frame within its parent element. It can have a value of top, or middle, or bottom, or left, or right. Since it is a presentational attribute, CSS should be used instead.
frameborder
This attribute can have a value of 1 or 0 which specifies if there should be a border around the frame or not. Since this is a presentational attribute, it is preferable to use the CSS border property instead.
height and width
This attribute can have a number or a percentage value. Number values specify the height (or width) of the Inline Frame in pixels and percentage values refer to the height (or width) of the parent element. Since this is a presentational attribute, it is preferable to use the CSS height or width property instead.
longdesc
The value of this attribute is a URL to a document that has a description of the content of the Inline Frame. This will help those who are browsing the frameset document non-visually. However, visual browsers such as Firefox, Internet Explorer, etc. do not provide any method to view the document specified in longdesc.
Example: <iframe src="fr.html" longdesc="frdesc.html">
marginheight
The value of this attribute, a number, specifies the top and bottom margins between the displayed contents of the source file of the Inline Frame and its inner edge.
marginwidth
The value of this attribute, a number, specifies the left and right margins between the displayed contents of the source file of the Inline Frame and its inner edge.
name
This attribute assigns a name to the Inline Frame so that it can be targetted by links having the target attribute.
scrolling
This attribute can take one of these values: yes,no or auto. With yes, scrollbars are always show whether they are needed or not. With no, scrollbars are never shown. With auto, scrollbars are shown when needed, this is the default.
src
The value of this attribute is a URL that specifies the initial file that will be displayed in the frame. The src attribute can refer to any file, even to another frameset document.

No comments: