HTML
HTML introduction
HTML basics
HTML colors
HTML backgrounds
HTML text
HTML font
HTML text formatting
HTML entities
Display tags
HTML links
Email links
Types of links
HTML images
HTML image maps
HTML tables
HTML frames
HTML forms
Fieldset/legend tags
HTML stylesheets
Div/span tags
HTML layout
HTML marquees
HTML multimedia
HTML meta tags
HTML document types
HTML base tag
HTML scripts
URL formatting
Encoding and decoding
HTML summary

Programming

Programming intro
Java

Markup

First webpage guide
XHTML

Style & Layout

CSS

Browser scripting

Javascript
VBScript
AJAX

Server scripting

PHP
ASP

Making money online

Make money online

HTML frames

Frames give you the ability to display more than one page in the same window.

This lesson focuses on:

The <frameset> tag

The <frameset> tag specifies that a page will be composed of frames.

Attributes of the <frameset> tag:


The <frame> tag

The <frame> tag denotes a frame in a frames page.

Attributes of the <frame> tag:

Example:

<frameset rows="50%, 50%">
<frame src="frameone.php" src="frameone" />
<frame src="frametwo.php" src="frametwo" />
</frameset>

In this example, there is a frameset with two rows. The first row is set to 50% of the height of the browser window, and the second row is set to 50% as well. The page "frameone.php" is put into the first row, and the page "frametwo.php" is put into the second row.

NOTE: The <frame> tag does not have an end tag.

Dealing with browsers that do not support frames

Not all browsers can handle frames, for such a situation, use the <noframes> tag. If someone tries to access a frames page through a browser that can not handle frames, they will see what is specified with the <noframes> tag.

Example:

<noframes>
<body>
Your browser does not support frames! 
</body>
</noframes>

NOTE: When creating a frames page, do not use the <body></body> tags. However, if you use the <noframes> tag, sorround the data in it with <body></body> tags. Also, the <noframes> tag goes inside the <frameset> tag.

Example:

<frameset rows="50%, 50%">
<noframes>
<body>
Your browser does not support frames! 
</body>
</noframes>
<frame src="frameone.php" src="frameone" />
<frame src="frametwo.php" src="frametwo" />
</frameset>

Inline frames

Another type of frame is an inline frame - a frame inside a webpage that is not within a frameset. An inline frame is declared with the <iframe> tag.

Attributes of the <iframe> tag:

Example:

<iframe src="http://www.yahoo.com" name="iframeone" 
width="110" height="110"></iframe>

This example will display the web address www.yahoo.com in an inline frame. The name of the inline frame is 'iframeone'.

Output:

Examples

Horizontal frames
This example demonstrates creating horizontal frames.

Vertical frames
This example demonstrates creating vertical frames.

Mixed frames
This example demonstrates creating mixed horizontal/vertical frames.

Mixed frames 2
This example demonstrates creating another set of mixed horizontal/vertical frames.

See more frames examples

Practice

Online code editor
Practical examples
Practical exercises
Step-by-step tutorials

Reference

Terms glossary
Reference material

Rate this site

Rate this site
Visitor comments