Data KonceptsHTML FramesData KonceptsHTML Frames![]() |
||||||
![]() ![]() ![]() This page will provide an overview of HTML frames Frames have a mixed history. While they are tremendously useful from the standpoint of providing a static navigation scheme, headers and footers, they are not handled well by search engines so are to be avoided whenever possible. Frames documents are generated by three things:
FRAME DOCUMENTA Frame document has a basic structure very much like your normal HTML document, except the <BODY> ... </BODY> element pair is replaced by a <FRAMESET> ... </FRAMESET> element pair which describes the sub-HTML documents, or frames, that will make up the page. <HTML> <HEAD> ... </HEAD> <FRAMESET> ... </FRAMESET> </HTML> FRAME SYNTAXFrame syntax is similar in scope and complexity to that used by tables. <FRAMESET> ... </FRAMESET>This is the main container for a Frame. <FRAMESET> Attributes<FRAMESET attributes> ... <FRAMESET> is the format where there are only two possible attributes: ROWS and COLS. ROWS="row_height_value_list" The ROWS attribute is assigned a comma separated list of values. These values can be absolute, percentage, or relative scaling values. Since the total height of all the rows must equal the height of the window, row heights might be normalized. A missing ROWS attribute is interpreted as a single row arbitrarily sized to fit.
COLS="column_width_list" The COLS attribute is also a comma separated list of the exact same syntax as described above for the ROWS attribute. <FRAMESET> ElementsA frame document has no BODY element pair, and no elements that would normally be placed in the BODY can appear before the FRAMESET element, or the FRAMESET element will be ignored. The FRAMESET element is a matched pair, and within the FRAMESET element pair, you can only have other nested FRAMESET element pairs, FRAME elements, or the NOFRAMES element pair. FRAMESET element pairs can be nested inside other FRAMESET element pairs. This would place the complete subframe in the space that would be used for the corresponding frame if this had been a FRAME element instead of a nested FRAMESET element pair. <FRAME>
The FRAME element does not have a matching end element <NOFRAMES> ... </NOFRAMES>This element pair is for content providers who want to create alternative content that is viewable by non-Frame-capable browsers. A Frame-capable Internet client ignores everything contained in the NOFRAMES element pair.
EXAMPLESThis example compares FRAME syntax and TABLE syntax, and will show the HTML source used to display the layout below. +----------------------------------------------------------+ | | | | | | | | | | | | | |---------------------+ | | | | | | | | | | | | +---------------------| | | | | | | | | | | | | | | |---------------------+ | | | | | | | | | | | | +----------------------------------------------------------+ THE ABOVE LAYOUT USING TABLES<CENTER> <TABLE WIDTH="100%" HEIGHT="100%" BORDER=4> <TR><TD ROWSPAN=2>CELL1 </TD> <TD>CELL2</TD></TR> <TR><TD ROWSPAN=2>CELL3</TD></TR> <TR><TD ROWSPAN=2>CELL4</TD></TR> <TR><TD>CELL5</TD></TR> </TABLE> </CENTER>
THE ABOVE LAYOUT USING FRAMES<FRAMESET COLS="50%,50%"> <FRAMESET ROWS="50%,50%"> <FRAME SRC="cell.html"> <FRAME SRC="cell.html"> </FRAMESET> <FRAMESET ROWS="33%,33%,33%"> <FRAME SRC="cell.html"> <FRAME SRC="cell.html"> <FRAME SRC="cell.html"> </FRAMESET> </FRAMESET>View the frame. THE ABOVE LAYOUT USING NOFRAMES INFO<FRAMESET COLS="50%,50%"> <FRAMESET ROWS="50%,50%"> <FRAME SRC="cell.html"> <FRAME SRC="cell.html"> </FRAMESET> <FRAMESET ROWS="33%,33%,33%"> <FRAME SRC="cell.html"> <FRAME SRC="cell.html"> <FRAME SRC="cell.html"> </FRAMESET> </FRAMESET> <NOFRAMES> <CENTER> <H1><BLINK>Frame ALERT!</BLINK></H1> <{ Oh, this is an example of the <B><I>very irritating</I> BLINK</B>ing element! } <P> <P> This document is designed to be viewed using<BR> <B>Netscape 2.0+'s and IE 3.0+'s</B> Frame features.<P> <P> If you are seeing this message,<BR> you are using a <I>"frame challenged"</I> browser.<P> Download your copy of <A HREF=http://home.netscape.com/> Netscape</A> now!<P> <P> </CENTER> </NOFRAMES>View the frame. NOTE: If you are using Netscape 2.0+ or IE3+, you will NOT see the NOFRAME data. Conversely, if you are not, you will ONLY see the NOFRAME data. Practical ExampleWith the e-mail I get requesting clarification of creation and naming issues, I've decided to create an example for you to use. In our window, we'll create three frames: A "header" frame for our title, a fixed width table of contents ("toc") for site navigation and a contents "main" frame. <HTML> <HEAD> <TITLE< Practical Frame Example</TITLE> </HEAD> <FRAMESET COLS="70,*"> <FRAME NAME="header" SRC="title_page.html"> <FRAMESET ROWS="150,*"> <FRAME NAME="toc" SRC="table_of_contents.html"> <FRAME NAME="main" SRC="first_document.html"> </FRAMESET> </FRAMESET> <NOFRAMES> <!-- Make accommodation for your non-framed visitors here --> </NOFRAMES> </HTML> The above code is all that is required for your default page. It established A framed page with ...
I hope this update will simplify your life! Escape FramesIf someone is displaying a particularly good page of yours on their site(using frames), you can "escape frames" by adding the following Javascriptcode to your page header(s):
On JavaScript-enabled browsers, this will pop your page to the TOP replacing the content thief's frameset with your page. Go back to: or go on to take a look at: |
||||||
|