Home : Internet : HTML : Frames

Using Frames in Web Pages

Frames are a way to solve certain problems and achieve certain effects in web design. The most common reason to use frames is to create a static area in the browser window which always stays the same while another part of the window is free to scroll or otherwise change. This can be useful, for example, for a navigation menu.

Before using frames in your website we strongly recommend that you read Pros and cons of using frames first.

Frames pages are based on a frameset - a single HTML document which defines which other pages to use as frames, and how to display them.

A basic example of a frameset is shown below. This creates a static frame on the left, with the main frame on the right.

<html>
<head>
<title>Home Page</title>
</head>
<frameset cols="80,*" frameborder="NO" border="0" framespacing="0">
<frame src="menu.html" name="leftFrame" scrolling="NO" noresize>
<frame src="mainpage.html" name="mainFrame">
</frameset>
<noframes><body>
This is the content seen if frames aren't supported, and by search engines.
</body></noframes>
</html>