CoderTools Web site

HTML Frames

Creating Frames


You may want to create seperate windows within your html page where each window can contain a seperate html document. One way to do this is to use the frameset and frame tags.

Examples for <frames>

The first tag to know when using frames is the <frameset> tag. The frameset tag is used instead of the body tag and it cannot contain any content. The frameset tags purpose is to define the frames and their positions.
The example shows two frames seperated by a horizontal splitter. The first frame has a height of 200px and the second frame has the remaining height of the window (*).
    <html>
        <frameset rows="200,*">
            <frame src="html_index.aspx" />
            <frame src="html_frames.aspx" />
        </frameset>
    </html>Give it a go!
This example is the same as before except the two frames are separated by a vertical splitter.
    <html>
        <frameset cols="200,*">
            <frame src="html_index.aspx" />
            <frame src="html_frames.aspx" />
        </frameset>
    </html>Give it a go!
Third examples shows the use of nested frames. This example displays a left frame of 200pixels a right frame that contains frameset with two frames occupying 50% of the frame height. Sub Framesets:
    <html>
        <frameset cols="200,*" >
            <frame src="html_index.aspx" />
            <frameset rows="50%,50%" >
                <frame src="html_index.aspx" />
                <frame src="html_index.aspx" />
            </frameset>
        </frameset>
    </html>Give it a go!

Attributes for <frameset>


Name Values Description
cols a number
a percentage e.g. 50%
*
Specify the width of the frames in pixels, a %age or * for all remaining width. A comma is used after each value e.g if two frames then 50,25
Rows a number
a percentage e.g. 50%
*
Specify the height of the frames in pixels, a %age or * for all remaining width. A comma is used after each value e.g if two frames then 50,25

Attributes for <frame>


Name Values Description
src url A url of a page to display in the frame
frameborder 1
0
the value 1 creates a separator between the frame and surrounding frames.
longdesc url a link to a file that contains a long description of the frame contents.
marginheight number e.g. 10 A value in pixels(px) which is the size of the margin between the top of the frame and the contents, and between the bottom of the frame and its contents
marginwidth number e.g. 10 Value in pixels which is the size of the margin between the left edge of the frame and its contents, and between the right edge of the frame and the frame contents.
name text Used by target attributes in links to identify which frame to load a page in.
noresize noresize Stops the frame being resized.
scrolling yes
no
auto
If yes scroll bars appear in the frame. If no then scrollbars dont appear. If auto then scroll bars appear when frame contents are larger than the frame size. Auto is the default.

10/23/2017 12:49:52 AM
Terms Of Use | Privacy Statement | Copyright 2006-2015 © Independence Software LLP