This lesson focuses on a less important, but still interesting part of HTML. Frames can be used to load two or more webpages into the web browser at once. You've probably seen examples of frames before on other websites. They are usually used as a menu on the left side. The setup of frames is very different from normal HTML commands. To start a frames page, you must make the <html> tag at the top of the page, but DO NOT make a <body> tag. Write the following code:
<frame src="menu.html" name="menu">
<frame src="main.html" name="main">
In the example above, I have created a simple frame layout that will create a column down the left side that is 125 pixels wide (a good width for a menu) and the other column is a lot bigger. The meat of the page will go into the bigger column. In the <frame src> tags, I have specified pages to load into those particular areas. For example, menu.html will be an HTML menu that will load into the smaller column on the side. The file main.html will be the main area of the page and will load into the larger section of the page. Click here to see what this basic layout will look like.
You might have noticed that I also specified a name for each <frame src> tag. These names are essential when you get into linking to other things while using frames. This is called targeting. When you have a page that is made with frames, you must target all of the links. Below is an example of what a targeted link will look like:
<a href="link.html" target="main">
This makes it so that if I had a link on a frames page, and I clicked on it, it would display itself in the main area of the page. Click here and click the links in the menu to the left to see an example of targeted and non-targeted frames. This is as far as I'll go into frames, because I really don't think they're that great.
<<<<Previous lesson ||||||