Kumail.pk is a Free Platform of

Framesets

Framesets: HTML frames are powerful elements which allow displaying the contents of another HTML document within a web page. A web page can be divided into multiple sections and each section can display all contents from a different web page by using frames.

Framesets dene how a web page is divided into rows and columns to display multiple frames on that web page. It is dened by tag and contains one or more tags.

Framesets

Framesets

HTML frames allow authors to present documents in multiple views, which may be independent windows or sub windows. Multiple views offer designers a way to keep certain information visible, while other views are scrolled or replaced. For example, within the same window, one frame might display a static banner, a second a navigation menu, and a third the main document that can be scrolled through or replaced by navigating in the second frame.

Here is a simple frame document:

that might create a frame layout something like this:

 ---------------------------------------
|         |                             |
|         |                             |
| Frame 1 |                             |
|         |                             |
|         |                             |
|---------|                             |
|         |          Frame 3            |
|         |                             |
|         |                             |
|         |                             |
| Frame 2 |                             |
|         |                             |
|         |                             |
|         |                             |
|         |                             |
 ---------------------------------------

If the user agent can’t display frames or is configured not to, it will render the contents of the NOFRAMES element.

16.2 Layout of frames

An HTML document that describes frame layout (called a frameset document) has a different makeup than an HTML document without frames. A standard document has one HEAD section and one BODY. A frameset document has a HEAD, and a FRAMESET in place of the BODY.

The FRAMESET section of a document specifies the layout of views in the main user agent window. In addition, the FRAMESET section can contain a NOFRAMES element to provide alternate content for user agents that do not support frames or are configured not to display frames.

Elements that might normally be placed in the BODY element must not appear before the first FRAMESET element or the FRAMESET will be ignored.

16.2.1 The FRAMESET element

<![ %HTML.Frameset; [
<!ELEMENT FRAMESET - - ((FRAMESET|FRAME)+ & NOFRAMES?) -- window subdivision-->
<!ATTLIST FRAMESET
  %coreattrs;                          -- id, class, style, title --
  rows        %MultiLengths; #IMPLIED  -- list of lengths,
                                          default: 100% (1 row) --
  cols        %MultiLengths; #IMPLIED  -- list of lengths,
                                          default: 100% (1 col) --
  onload      %Script;       #IMPLIED  -- all the frames have been loaded  -- 
  onunload    %Script;       #IMPLIED  -- all the frames have been removed -- 
  >
]]>

Attribute definitions

rows = multi-length-list [CN]
This attribute specifies the layout of horizontal frames. It is a comma-separated list of pixels, percentages, and relative lengths. The default value is 100%, meaning one row.
cols = multi-length-list [CN]
This attribute specifies the layout of vertical frames. It is a comma-separated list of pixels, percentages, and relative lengths. The default value is 100%, meaning one column.

The FRAMESET element specifies the layout of the main user window in terms of rectangular subspaces.

Rows and columns 

Setting the rows attribute defines the number of horizontal subspaces in a frameset. Setting the cols attribute defines the number of vertical subspaces. Both attributes may be set simultaneously to create a grid.

If the rows attribute is not set, each column extends the entire length of the page. If the cols attribute is not set, each row extends the entire width of the page. If neither attribute is set, the frame takes up exactly the size of the page.

Frames are created left-to-right for columns and top-to-bottom for rows. When both attributes are specified, views are created left-to-right in the top row, left-to-right in the second row, etc.

The first example divides the screen vertically in two (i.e., creates a top half and a bottom half).

...the rest of the definition...

The next example creates three columns: the second has a fixed width of 250 pixels (useful, for example, to hold an image with a known size). The first receives 25% of the remaining space and the third 75% of the remaining space.

...the rest of the definition...

The next example creates a 2×3 grid of subspaces.

...the rest of the definition...

For the next example, suppose the browser window is currently 1000 pixels high. The first view is allotted 30% of the total height (300 pixels). The second view is specified to be exactly 400 pixels high. This leaves 300 pixels to be divided between the other two frames. The fourth frame’s height is specified as “2*”, so it is twice as high as the third frame, whose height is only “*” (equivalent to 1*). Therefore the third frame will be 100 pixels high and the fourth will be 200 pixels high.

...the rest of the definition...

Absolute lengths that do not sum to 100% of the real available space should be adjusted by the user agent. When underspecified, remaining space should be allotted proportionally to each view. When overspecified, each view should be reduced according to its specified proportion of the total space.

Nested frame sets 

Framesets may be nested to any level.

In the following example, the outer FRAMESET divides the available space into three equal columns. The inner FRAMESET then divides the second area into two rows of unequal height.

     ...contents of first frame...
     
        ...contents of second frame, first row...
        ...contents of second frame, second row...
     
     ...contents of third frame...

Sharing data among frames 

Authors may share data among several frames by including this data via an OBJECT element. Authors should include the OBJECT element in the HEAD element of a frameset document and name it with the id attribute. Any document that is the contents of a frame in the frameset may refer to this identifier.

The following example illustrates how a script might refer to an OBJECT element defined for an entire frameset:


 ...the beginning of the document...

…the rest of the document…

16.2.2 The FRAME element

<![ %HTML.Frameset; [

<!ELEMENT FRAME - O EMPTY              -- subwindow -->
<!ATTLIST FRAME
  %coreattrs;                          -- id, class, style, title --
  longdesc    %URI;          #IMPLIED  -- link to long description
                                          (complements title) --
  name        CDATA          #IMPLIED  -- name of frame for targetting --
  src         %URI;          #IMPLIED  -- source of frame content --
  frameborder (1|0)          1         -- request frame borders? --
  marginwidth %Pixels;       #IMPLIED  -- margin widths in pixels --
  marginheight %Pixels;      #IMPLIED  -- margin height in pixels --
  noresize    (noresize)     #IMPLIED  -- allow users to resize frames? --
  scrolling   (yes|no|auto)  auto      -- scrollbar or none --
  >
]]>

Attribute definitions

name = cdata [CI]
This attribute assigns a name to the current frame. This name may be used as the target of subsequent links.
longdesc = uri [CT]
This attribute specifies a link to a long description of the frame. This description should supplement the short description provided using the title attribute, and may be particularly useful for non-visual user agents.
src = uri [CT]
This attribute specifies the location of the initial contents to be contained in the frame.
noresize [CI]
When present, this boolean attribute tells the user agent that the frame window must not be resizeable.
scrolling = auto|yes|no [CI]

This attribute specifies scroll information for the frame window. Possible values

  • auto: This value tells the user agent to provide scrolling devices for the frame window when necessary. This is the default value.
  • yes: This value tells the user agent to always provide scrolling devices for the frame window.
  • no: This value tells the user agent not to provide scrolling devices for the frame window.
frameborder = 1|0 [CN]

This attribute provides the user agent with information about the frame border. Possible values:

  • 1: This value tells the user agent to draw a separator between this frame and every adjoining frame. This is the default value.
  • 0: This value tells the user agent not to draw a separator between this frame and every adjoining frame. Note that separators may be drawn next to this frame nonetheless if specified by other frames.
marginwidth = pixels [CN]
This attribute specifies the amount of space to be left between the frame’s contents in its left and right margins. The value must be greater than zero (pixels). The default value depends on the user agent.
marginheight = pixels [CN]
This attribute specifies the amount of space to be left between the frame’s contents in its top and bottom margins. The value must be greater than zero (pixels). The default value depends on the user agent.

The FRAME element defines the contents and appearance of a single frame.

Setting the initial contents of a frame 

The src attribute specifies the initial document the frame will contain.

The following example HTML document:

should create a frame layout something like this:

 ------------------------------------------
|Frame 1     |Frame 3       |Frame 4       |
|            |              |              |
|            |              |              |
|            |              |              |
|            |              |              |
|            |              |              |
|            |              |              |
|            |              |              |
-------------|              |              |
|Frame 2     |              |              |
|            |              |              |
|            |              |              |
 ------------------------------------------

and cause the user agent to load each file into a separate view.

The contents of a frame must not be in the same document as the frame’s definition.

Framesets

Framesets

Apply for Free E-Certification

E-Certification