HTML - Advanced - 2

Frames - also depricated - use CSS instead

Again you need to remember rows and columns. In short, columns stand up (like in buildings) - rows are horizontal.

So, lets have a look at frames. You've seen them everywhere on the web. You may also know them as Windows. They are used to split the screen into sections, then to display a particular file within a particular frame. Here's how to do them.

1) First you need a holding file to set up the first two frames. Normally I call this frame.html.
It contains the following tags
<frameset>
<frame src> - for the number of frames you are creating
</frameset>

2) You can set up frames to be horizontal, or vertical which is why you need to remember what cols and rows are.
<frameset cols=""> will break the window up into two a left and a right, sized depending on what you add to the statement. <frameset rows> sets up a top and bottom split.

So, something like
<frameset cols="20%,*">
would give you a left column spanning for 20% of the screen, and a second column spanning the rest of the screen.You can also set them up with the number of pixels each frame will span.

3) Next, what will you put into the frames. Well, why else are you bothering to create them?
You need to tell the browser where to find the content. So within the frame.html file, you would put:-

<frame src="buts.html" name="menu">
<frame src="home.html" name="main">

Let's break down this code.

  1. We are putting an HTML file called buts.html into a frame which we are now naming menu.
  2. Then, we are putting another HTML file called home.html into the second frame, which we are naming main
Finally, close the frameset with </frameset> The <frameset> does not need the <body> tags set up. It sits between the </head> and before the </HTML>.

Not very difficult once you understand the concept.

Previous Page click for Next Page
Any questions/feedback