Iframe, which has been part of the HTML specification since
version 4 and is supported in nearly all modern browsers, is the webpage
element that creates an inline frame that contains another document. Iframe
functions as a sub document within a document, or like a floating frame. It is
able to load another html document within the <iframe> tags.
The following example uses the IFRAME element and an HTML
fragment to create a frame containing the main page of google.
Listing 1: An example of a minimal IFRAME
<IFRAME ID=IFrame1 FRAMEBORDER=0 SCROLLING=NO SRC="http://www.google.com">
</IFRAME>
Grammatically, the usage of IFRAME quite simulates that of
div, such as you can specify the position, color and layout of them embedded
inside a web page. The following table gives the commonly-used parameters for
an IFrame element.
Table 1: Parameters for an HTML Iframe Element
Parameters
|
Comments
|
Src
|
URI (URI of frame content)
|
Name
|
CDATA (name of frame)
|
Longdesc
|
URI (link to long description)
|
Width
|
Length (frame width)
|
Height
|
Length (frame height)
|
Align
|
[ top | middle | bottom | left | right ] (frame alignment)
|
Frameborder
|
[ 1 | 0 ] (frame border)
|
Marginwidth
|
Pixels (margin width)
|
Marginheight
|
Pixels (margin height)
|
Scrolling
|
[ yes | no | auto ] (ability to scroll)
|
Enough already with the concept! Let us get to the code.