This is an old revision of the document!


Frames

There are two kinds of frames, iframes and frameset, this page is dedicated to frameset: for iframes head over here!

Notable frameset sites are melonking.net and the spacejam website!

This is a short guide on how to use frameset to make a homepage:

A frameset is a cool way of splitting up a web page into different parts, called frames, that can show different HTML pages. A frameset can be handy for making a homepage that has a nice layout, like a menu, a header, or a footer, that stays the same when you click on different links.

  • To use frameset on a page, you need to use the <frameset> tag instead of the <body> tag. The <frameset> tag tells the browser how to split up the window into frames, using the rows and cols attributes. The rows attribute says how many and how big the horizontal frames are, and the cols attribute says how many and how big the vertical frames are. You can use pixels, percentages, or asterisks to say the size of each frame.
  • For example, <frameset rows=“100,*,50” cols=“25%,75%”> means that the window will be split into three horizontal frames, with the first one being 100 pixels tall, the second one taking up the rest of the space, and the third one being 50 pixels tall. The window will also be split into two vertical frames, with the first one being 25% wide, and the second one being 75% wide.
  • Each frame is marked by the <frame> tag, which says which HTML page will show up in the frame. The <frame> tag has a src attribute, which says the URL of the page to show. The <frame> tag can also have a name attribute, which can be used to make links open in a specific frame.
  • For example, <frame src=“nav.html” name=“nav”> means that the frame will show the page nav.html, and it will have the name nav. This name can be used to make links open in this frame, by using the target attribute of the <a> tag. For example, <a href=“home.html” target=“nav”>Home</a> means that the link will open the page home.html in the frame named nav.
  • You can also use the <noframes> tag to give some other content for browsers that don’t like frames. The <noframes> tag should go inside the <frameset> tag, and it should have a <body> tag with the other content. For example, <noframes><body>Your browser doesn't like frames.</body></noframes> means that the browser will show the message “Your browser doesn’t like frames.” if it can’t show the frameset.

Here is an example of a homepage that uses frameset to make a layout with a header, a menu, a main area, and a footer:

<html>
<head>
<title>My Homepage</title>
</head>
<frameset rows="100,*,50" cols="25%,75%">
<frame src="header.html" name="header">
<frameset cols="25%,75%">
<frame src="nav.html" name="nav">
<frame src="home.html" name="main">
</frameset>
<frame src="footer.html" name="footer">
<noframes>
<body>
Your browser doesn't like frames.
</body>
</noframes>
</frameset>
</html>

You might also want to install Melon's frame link fix - this is a small script that will allow you to share links to frames in the same way as a normal webpage - take a look at the thread below: See melon's frame link fix!