frameset Creating Documents with Frames

<frameset> Creating Documents with Frames

You use the <frameset> element when you want to display frames in a document. The <frameset> element replaces the <body> element in such documents; in XHTML 1.0, that means you use the XHTML 1.0 Frameset DTD. This element is supported in XHTML 1.0 Frameset only. The <frame> and <frameset> elements are not supported in XHTML 1.1; the XHTML 1.1 DTD does not makes any mention of these elements or of frames at all, and these elements are specifically listed as unsupported in XHTML 1.1. Why aren't frames supported in XHTML 1.1? They're not supported because W3C expects stylesheets to handle the presentation techniques that you use frames for today. Whether the Web community will ultimately accept that is anyone 's guess.

Here are the attributes of this element:

  • class Gives the style class of the element. (XHTML 1.0 Frameset.)

  • cols Sets the number of columns (vertical framed bands) in the frameset. (XHTML 1.0 Frameset.)

  • dir Sets the direction of text that doesn't have an inherent direction in which you should read it, called directionally neutral text. You can set this attribute to ltr , for left-to-right text, or rtl , for right-to-left text. (XHTML 1.0 Frameset.)

  • id Refers to the element; set this attribute to a unique identifier. (XHTML 1.0 Frameset.)

  • lang Specifies the base language used in the element. Applies only when the document is interpreted as HTML. (XHTML 1.0 Frameset.)

  • rows Sets the number of rows (horizontal framed bands) in the frameset. (XHTML 1.0 Frameset.)

  • style Inline style indicating how to render the element. (XHTML 1.0 Frameset.)

  • title Contains the title of the element. (XHTML 1.0 Frameset.)

  • xml:lang Specifies the base language for the element when the document is interpreted as an XML document. (XHTML 1.0 Frameset.)

This element supports no XHTML events.

You use the <frameset> element and the XHTML frameset DTD to format a page into frames. This element takes the place of the <body> element in documents that display frames. To create the frames themselves , you use the <frame> element.

To format the display into frames, you use the rows or cols attributes of the <frameset> element. You indicate the number of rows or columns you want to use by giving their heights or widths in a comma-separated list. To specify those heights or widths, you can give pixel measurements or a percentage measurement (such as "40%" ) to request a percentage of the available display area. If you use an asterisk, the browser will try to give you the remaining display area; for example, cols="200, *" creates one vertical frame of 200 pixels and a second vertical frame filling the remainder of the display area. I recommend using percentage measurements rather than pixel measurements because the user may resize the browser window, unless you're using wide graphics or table with set widths.

For example, here's how I creates two columnsthat is, two vertical frameseach of which take up half the available width (note that I'm using the XHTML 1.0 Frameset DTD):

 <?xml version="1.0"?>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">     <head>         <title>             Using XHTML Frames         </title>     </head>  <frameset cols = "50%, 50%">   .   .   .   </frameset>  </html> 

So how do you actually create the frames that should be displayed? Take a look at the next section.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net