Frameset, Frame and IFrame Elements in HTML
Frame Element
With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others.
Disadvantages of using frames:
1. Frames are not expected to be supported in future versions of HTML
2. Frames are difficult to use. (Printing the entire page is difficult).
3. The web developer must keep track of more HTML documents
2. Frames are difficult to use. (Printing the entire page is difficult).
3. The web developer must keep track of more HTML documents
Frameset Element
The frameset element holds one or more frame elements. Each frame element can hold a separate document. The frameset element states HOW MANY columns or rows there will be in the frameset, and HOW MUCH percentage/pixels of space will occupy each of them.
The
Example: The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The document "frame_a.htm" is put into the first column, and the document "frame_b.htm" is put into the second column:
IFrame Element
IFrame defines an inline sub window (frame). An iframe is used to display a web page within a web page.
Syntax:
The height and width attributes are used to specify the height and width of the iframe.
The attribute values are specified in pixels by default, but they can also be in percent (like "80%").
The attribute values are specified in pixels by default, but they can also be in percent (like "80%").
Example
The frameborder attribute specifies whether or not to display a border around the iframe.
Set the attribute value to "0" to remove the border:
Set the attribute value to "0" to remove the border:
Example
Points to note about Frames, Framesets and IFrames
1. The tag is supported in all major browsers.
2. If you want to validate a page containing frames, be sure the is set to either "HTML Frameset DTD" or "XHTML Frameset DTD".
3. If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, you can add noresize="noresize" to the tag.
4. Add the tag for browsers that do not support frames.
5. Inline frame is just one “box” that is placed anywhere on browser page. In contrast, frame is a bunch of boxes put together to make one site.
2. If you want to validate a page containing frames, be sure the is set to either "HTML Frameset DTD" or "XHTML Frameset DTD".
3. If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, you can add noresize="noresize" to the tag.
4. Add the
5. Inline frame is just one “box” that is placed anywhere on browser page. In contrast, frame is a bunch of boxes put together to make one site.