![]() Basic Frame Page{- BACK -}
Frames! Everyone would like to have them in their own site. They enhance the looks of the pages, giving them a professional appearance and a sense and feel of integration and easier navigation. Are frames that difficult? Frame implementation is quite easy. Here's where my advice about files and organization will work perfectly: having all your files in a single directory will make easier the transport of your personal web to other places, and preview it easily. First: create a main page (usually you would name it "index.html"), long file names come in handy. That page should have all of the basic elements normally found on a web page, (<HTML>, <TITLE> and <HEAD> tags) except the <BODY> tags. The <FRAMESET> tagsWhere the <BODY> tags should be, put a <FRAMESET> tag. This tag will begin the frame set processing on the browser. The parameters for the <FRAMESET> tag are the following:
The <FRAME> tagsAfter the <FRAMESET> tag, for every frame declared in the FRAMESET tag, put a <FRAME SRC="nameofpage.html" NAME="Frame name"> tag. For the SRC argument place the file you want (represented by "nameofpage.html" in the example). Name every frame differently using the NAME argument, that name will be used in the hyperlinks when you want to load a page in that specific frame. DO NOT WRITE ANYTHING IN THE MAIN DOCUMENT!!! TYPE YOUR TEXT INSIDE THE FILES YOU SPECIFIED ON EVERY FRAME TAGClosing the frame setAfter that, put a closing </FRAMESET> tag. That's all! Would you believe that? Now you've got a document set, let's say index.html, navbar.html and content.html and you want to frame them. What would you do? I'd do the following in index.html: <HTML> That would load "content.html" in the big frame, and "navbar.html" in the 100 pixel high frame. You don't have to do any changes to the referenced documents. The former example gave me a window divided in two rows, one below with 100 pixels height, and the other in the upper part of the window. The upper division was named "Contents" and displayed content.html, while the lower was named "Navigation bar" and showed navbar.html. That's why it is important to name the frames consistently. Now, in this example, I made the bottom division very small (100 pixels high), because I intended to include a navigation bar in there, with links that would let me navigate across the upper page (content.html). So, with our knowledge about tables, hyperlinks and bookmarks, we'll create a navigation bar for that document. Since "content.html" is very long and contains three sections, Part1, Part2 and Part3, we'll set a table with links to all these sections. We'll asume the bookmarks are already defined in "content.html" and we will only work around "navbar.html". What to do:
This is how the body of file as our navigation bar would look like: <TABLE> Links between frames: the TARGET= argumentThe TARGET argument in the <A HREF> tag tells the browser to load the link into the specified frame or window, named in the FRAME tags. Or, instead of a frame name, you can put "_top" to load into the full window, "_self" to load in the same frame, and "_blank" on a new, blank window. Handy, isn't it? This is the way the navigation bar at your left is built, just that instead of saying Part 1, 2 or 3, I nested graphics on the hyperlinks, specifying BORDER=0 in the IMG tags, to avoid the display of a nasty blue border around my little nifty graphics. Nesting framesYou can nest frames. One or both of the source documents for your frame set (specified in the SRC= parameter of the FRAME tag) can have a FRAMESET too. The frameset's frames on the "child" document will fit into the frame for the child document. Use of the <NOFRAMES> tagThe <NOFRAMES> tag is for people who don't have frames. It is used like this: <NOFRAMES> Text inside the <NOFRAMES> tag won't be displayed by frames-enabled browsers, so be cool and place there some info to help people using frames-disabled browsers. Place the <NOFRAMES> tags after the frame set, and do not put any body tags outside them. One more thing about frames: there are other kind of frames, such as floating and embedded frames. These go beyond the scope of this document yet. For now, use your preferred search engine to look up information about these.
Sample Frames
<HTML> Frames Sample #2: <HTML> Frames Sample #3: <HTML>
Frames Sample #4: <HTML>
| Back to HTML Help! | Return to Home Page | Last modified: July 01,
2001 |