HTML Frames Code

You can use the following HTML code to create a web page split into frames.

You can also check out these HTML frames templates and the HTML Frames page of the HTML Tutorial.

Example HTML Frames Code:

To make frames in HTML, you need 3 or more pages. One page is the frameset page, the other pages are for each individual frame. The following code is for a frameset page. Note the code pointing to 2 other pages - one for the left frame, the other for the right frame.

The frameset page:

<html>
<head>
<title>Frameset page<title>
</head>
<frameset cols = "25%, *">
  <noframes>
  <body>Your browser doesn't support frames.
  Therefore, this is the noframe version of the site.</body>
  </noframes>
  <frame src ="/html/tutorial/frame_example_left.html" />
  <frame src ="/html/tutorial/frame_example_right.html" />
</frameset>
</html>

The left frame (frame_example_left.html):

<html>
<body style="background-color:green">
<p>This is the left frame (frame_example_left.html).</p>
</body>
</html>

The right frame (frame_example_right.html):

<html>
<body style="background-color:yellow">
<p>This is the right frame (frame_example_right.html).</p>
</body>
</html>
View the result

Frame Templates

The frameset tags contain other tags nested within them. These other tags define the actual frames that appear within the document (the frameset document).

You can use the following template as a basis for your HTML frames code. Simply fill in the blanks or remove uneeded attributes.

Since HTML frames code is made up of several tags, each tag is presented separately here.

1. The <frameset> Tag

For an explanation of all the attributes, see the HTML frameset tag specifications.

<frameset
	rows=""
	cols=""
	class=""
	id=""
	title=""
	style=""
	onload=""
	onunload="" >

	(the individual frames go here - see below)

	</frameset>

2. The <frame> Tag

This tag defines each frame within the frameset.

For an explanation of all the attributes, see the HTML frame tag specifications.

<frame
	name=""
	longdesc=""
	src=""
	noresize=""
	scrolling=""
	frameborder=""
	marginwidth=""
	marginheight=""
	class=""
	id=""
	title=""
	style="" />

3. The <noframes> Tag

This tag defines what to display if the browser doesn't support frames.

For an explanation of all the attributes, see the HTML noframes tag specifications.

<noframes
	class=""
	id=""
	title=""
	style=""
	lang=""
	dir=""
	onclick=""
	ondbclick=""
	onmousedown=""
	onmouseup=""
	onmouseover=""
	onmousemove=""
	onmouseout=""
	onkeypress=""
	onkeydown=""
	onkeyup="" >

(content to display if browser doesn't support frames)

</noframes>

Don't forget to check out these HTML frames templates.

Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!

Sponsored Link: Design CODE-FREE Websites

Check a Domain:

ZappyHost Logo
Webydo Banner Ad