In our previous article we learned to work with links and entities (or special characters) in HTML and how HTML handles white space. In this episode we will discuss how to use frames to create pages within the page and how to use lists.
You can use frames to display more than one page in a browser window. This is useful for a variety of things, particularly if you want to create a menu bar across your website without having to program it or copy and paste it over every page. For instance, you can set your menu bar in a frame on the left side of the page, and when the user clicks on a link, the page will load in the center of the page (to the right of the menu bar frame).
There are four places to set your frames in an HTML page. You can set them vertically, horizontally, a mixture of the two, or inline, which we will discuss in a few moments.
Setting a Frame in the Vertical Position
Framesets use column and rows to determine where a frame is located. To set the frame vertically, we use the cols property:
The above sample creates two frames in the vertical position. It does this using the line: <frameset cols=”20%”,80%”>. The word cols stands for column, and decides where the frame will appear (vertically for cols) and the 20%,80% decided the amount of the page the frame will take up. For instance, in this case we have two frames. The first frame (and the page nestled within it) will take up 20% of the browser. The second frame (and once again, the page within it) will take up the remaining 80% of the browser.
Next, we use the <frame src> to tell the browser which page to insert into the frame.