Main  Basic   Advanced  Download  

Frames 1  

OK, well done for getting this far in this guide, hope you are following me so far.
Frames are a really good way of making your page look professional and just really cool, if used in the right way.
Frames are used to split the browser window into separate "compartments" into which you can put separate HTML pages. Many pages use frames: some people hate them, some people love them. Again, it does depend how you use them.

In actual fact frames are very easy to use once you know how: You start of with 100% of the browser window in columns (vertical bars) and 100% of rows (horizontal bars). All you have to do is divide it up by %s. A good way to think of it is that there are 100 vertical lines and 100 horizontal lines.
You start with the tag <FRAMESET> & </FRAMESET> in which you write which axis of the screen you want to split it by first: the horizontal or the vertical. For the horizontal we use the command ROWS, and for the verical COLS. This is placed into the FRAMESET command:


What we have done here is to split the screen into two equal parts accross the middle. The * in the command just means whatever is left of the screen after however many % you have set aside for the first section is given to the second section: so if instead of 50% we had put 65% the * would have represented 35%. The same thing can be done but splitting it vertically by using the COLS command in place of ROWS.
The next thing is that you can split a frame (compartment) into more smaller frames, like this:


This HTML would split the main window into two equal parts horizontally (so it would draw a horizontal grey line accross the screen) and then split the top part into three quarters on the left and a quarter on the right (75% and 25%).

One of the most important parts about frames is being able to put individual pages in them:
<FRAME SRC="apage.htm">
<FRAME SRC="anotherpage.htm">

This works by assuming that once you have given one command then that is the first compartment's page and then the second FRAME SRC is for the second compartment (which is the bottom one in this case). This assumption by the computer is also made on the question of dividing up individual compartments: when you open a FRAMESET tag then everything you do inside it will happen inside that compartment, except if you put in the SRC commands, in which case the first goes to the first compartment and the second to the second compartment and so on.
Several other useful commands in the FRAMESET tag are as follows:


MARGINHEIGHT and MARGINWIDTH specify how big the line separating the compartments is, I normally leave it as 10 for both of them.(x is a number).
NAME is used to just call the frame something meaningfull to you so that you can remember it when you use TARGET commands (explained later). Put it in block capitals to save you having to turn of CAPS LOCK when you are writing HTML.
BORDER is used to say if you want the grey splitter line showing or not. If you do then don't bother putting this in, otherwise put BORDER=0. FRAMEBORDER does the same thing, some browsers seem to prefer it.
SCROLLING=NO is to specify that you don't want anything that goes in that frame to have scrolling bars, even if the page doesn't fit in the frame. This is useful if you have an image that is just too large for the frame but that you can afford to not see a small bit of it without seeing those ugly scrolling bars.
Lastly, NORESIZE is used to say that you don't want the user to be able to resize the frames you specify in their browser, so they can't mess the layout up and then think the page is bad. I always use this command, it' s good in case someone accidentally tries to resize the page.
(Note: You must put these commands in every FRAMESET command that you want them to apply to).
Lastly, when you are linking a page in a frame to another page that you want to appear in another frame, and not the same one, you use the TARGET command in the <A HREF="somepage.htm"> statement, so it becomes <A HREF="somepage.htm" TARGET=ANYFRAME> This name must coincidee with the name given to the frame with the NAME command in the FRAMESET tag.

OK, see if you can work out what page these frameset commands are for, and what they do


Click here to see the resulting page (Use your back button to return to this page).


Copyright 1998 Iceman. All Rights Reserved. Further Legal Stuff

This page hosted by Get your own Free Home Page