Frames and Lists in HTML - Setting a Frame in the Horizontal Position
(Page 2 of 6 )
Framesets use the rows property to set the frames in the horizontal position. The size of the frames works in the same manner as our previous example:
<html>
<frameset rows="20%,40%,40%">
<frame src="firstframe.htm">
<frame src="secondframe.htm">
<frame src="thirdframe.htm">
</frameset>
</html>
Setting the Frame Horizontally and Vertically
As I mentioned before, you can set your frame both vertically and horizontally. This is useful for a variety of reasons. You could have your navigation frame on the left, an advertising frame at the top, and a page in the middle that displays the pages in your site when the user clicks on the links in your navigation frame. Here is how we set the frames:
<html>
<frameset rows="20%,70%">
<frame src="adframe.htm">
<frameset cols="20%,80%">
<frame src="navframe.htm">
<frame src="mainframe.htm">
</frameset>
</frameset>
</html>
As we discussed, you can use a frame as a navigation frame. When the user clicks on the links in this frame, it will load them in a different frame that you specify. To do so, you must create links to target the frame in which you wish the pages to load. You do that like this:
<a href ="aboutusframe.htm" target ="mainframe">About Us</a>
The above snippet of code creates a hyperlink in the phrase “About Us.” The hyperlink will load the page aboutusframe.htm in the mainframe frame. So let’s say you want to create a standard navigation menu, you would have a frame as your navigation frame (we will call it navframe). You would place these links within that page:
<a href ="homeframe.htm" target ="mainframe">Home><br></a>
<a href ="biographyframe.htm" target ="mainframe">Bio<br></a>
<a href ="commentsframe.htm" target ="mainframe">Comments<br></a>
<a href ="linksframe.htm" target ="mainframe">Links<br></a>
<a href ="aboutusframe.htm" target ="mainframe">About Us<br></a>
This creates a set of links for Home, Biography, Comments, Links, and an About Us page. When the user clicks any of these, it will load its respective page in the mainframe frame.
Next: Displaying Frame with the Iframe >>
More HTML Articles
More By James Payne