HTML frames allow authors to present documents in multiple views, which may be independent windows or subwindows. 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. Show Here is a simple frame document: A simple frameset 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 element. 16.2 Layout of framesAn 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 section and one . A frameset document has a , and a in place of the . The section of a document specifies the layout of views in the main user agent window. In addition, the section can contain a element to provide for user agents that do not support frames or are configured not to display frames. Elements that might normally be placed in the element must not appear before the first element or the will be ignored. Attribute definitions rows = 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 = 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.Attributes defined elsewhere The element specifies the layout of the main user window in terms of rectangular subspaces. Rows and columnsSetting the attribute defines the number of horizontal subspaces in a frameset. Setting the attribute defines the number of vertical subspaces. Both attributes may be set simultaneously to create a grid. If the attribute is not set, each column extends the entire length of the page. If the 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 2x3 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 setsFramesets may be nested to any level. In the following example, the outer divides the available space into three equal columns. The inner 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 framesAuthors may share data among several frames by including this data via an element. Authors should include the element in the element of a frameset document and name it with the 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 element defined for an entire frameset: This is a frameset with OBJECT in the HEAD Bianca's page ...the beginning of the document... Attribute definitions name = This attribute assigns a name to the current frame. This name may be used as the target of subsequent links.longdesc = This attribute specifies a link to a long description of the frame. This description should supplement the short description provided using the attribute, and may be particularly useful for non-visual user agents.src = This attribute specifies the location of the initial contents to be contained in the frame.noresize When present, this boolean attribute tells the user agent that the frame window must not be resizeable.scrolling = auto|yes|no This attribute specifies scroll information for the frame window. Possible values
Attributes defined elsewhere The element defines the contents and appearance of a single frame. Setting the initial contents of a frameThe attribute specifies the initial document the frame will contain. The following example HTML document: A frameset 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. ILLEGAL EXAMPLE: --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------0 Visual rendering of a frameThe following example illustrates the usage of the decorative attributes. We specify that frame 1 will allow no scroll bars. Frame 2 will leave white space around its contents (initially, an image file) and the frame will not be resizeable. No border will be drawn between frames 3 and 4. Borders will be drawn (by default) between frames 1, 2, and 3. A frameset document Note. For information about current practice in determining the target of a frame, please consult the in the appendix. Attribute definitions Please consult the section on for information about recognized frame names. This example illustrates how targets allow the dynamic modification of a frame's contents. First we define a frameset in the document frameset.html, shown here: --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------2 Then, in init_dynamic.html, we link to the frame named "dynamic". --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------3 Activating either link opens a new document in the frame named "dynamic" while the other frame, "fixed", maintains its initial contents. When many links in the same document designate the same target, it is possible to specify the target once and dispense with the attribute of each element. This is done by setting the attribute of the element. We return to the previous example, this time factoring the target information by defining it in the element and removing it from the elements. --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------4 User agents should determine the target frame in which to load a linked resource according to the following precedences (highest priority to lowest):
User agents may provide users with a mechanism to override the attribute. Authors should supply alternate content for those user agents that do not support frames or are configured not to display frames. Attributes defined elsewhere The element specifies content that should be displayed only by user agents that do not support frames or are configured not to display frames. User agents that support frames must only display the contents of a declaration when configured not to display frames. User agents that do not support frames must display the contents of in any case. The element is part of both the In a document that uses the frameset DTD, may be used at the end of the FRAMESET section of the document. For example: --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------5 may be used, for example, in a document that is the source of a frame and that uses the transitional DTD. This allows authors to explain the document's purpose in cases when it is viewed out of the frameset or with a user agent that doesn't support frames. The attribute allows authors to make frame documents more accessible to people using non-visual user agents. This attribute designates a resource that provides a long description of the frame. Authors should note that long descriptions associated with frames are attached to the frame, not the frame's contents. Since the contents may vary over time, the initial long description is likely to become inappropriate for the frame's later contents. In particular, authors should not include an image as the sole content of a frame. The following frameset document describes two frames. The left frame contains a table of contents and the right frame initially contains an image of an ostrich: --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------6 Note that the image has been included in the frame independently of any HTML element, so the author has no means of specifying alternate text other than via the attribute. If the contents of the right frame change (e.g., the user selects a rattlesnake from the table of contents), users will have no textual access to the frame's new content. Thus, authors should not put an image directly in a frame. Instead, the image should be specified in a separate HTML document, and therein annotated with the appropriate alternate text: --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------7 --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------8 Attribute definitions longdesc = This attribute specifies a link to a long description of the frame. This description should supplement the short description provided using the attribute, and is particularly useful for non-visual user agents.name = This attribute assigns a name to the current frame. This name may be used as the target of subsequent links.width = The width of the inline frame.height = The height of the inline frame.Attributes defined elsewhere The element allows authors to insert a frame within a block of text. Inserting an inline frame within a section of text is much like inserting an object via the element: they both allow you to insert an HTML document in the middle of another, they may both be aligned with surrounding text, etc.The information to be inserted inline is designated by the attribute of this element. The contents of the element, on the other hand, should only be displayed by user agents that do not support frames or are configured not to display frames. For user agents that support frames, the following example will place an inline frame surrounded by a border in the middle of the text. --------------------------------------- | | | | | | | Frame 1 | | | | | | | | |---------| | | | Frame 3 | | | | | | | | | | | Frame 2 | | | | | | | | | | | | | | ---------------------------------------9 Inline frames may not be resized (and thus, they do not take the attribute). Note. HTML documents may also be embedded in other HTML documents with the element. See the section on for details. What is the parent frame in HTML?parent property is a reference to the parent of the current window or subframe. If a window does not have a parent, its parent property is a reference to itself. When a window is loaded in an <iframe> , <object> , or <frame> , its parent is the window with the element embedding the window.
What is the difference between _parent and _self?_self: It opens the linked document in the same frame. it is the default value. _parent: It opens the linked document in the parent frameset. _top: It opens the linked document in the full body of the window.
What does it mean by parent frame?A parent iframe is an internal frame in a web page that holds a secondary web page or script. They are often called iframes, since the "parent" part of the name is from the viewpoint of its content.
What is the difference between parent and top target in HTML?A target attribute with the value of “_parent” opens the linked document in the parent frame. A target attribute with the value of “_top” opens the linked document in the full body of the window.
|