This page has been robot translated, sorry for typos if any. Original content here.

Working with Frames

Working with Frames

Frames are designed to divide the browser window into several parts, each of which can display information from different sources. The main advantage of frames is this - on one page can be combined information from several pages. In addition, thanks to frames, you do not need to include in each page of the site some elements that are the same on all pages, for example, a menu or logo. Such an element is placed in a separate frame and its contents do not change while the content of the remaining frames on the page can be anything. However, frames have drawbacks. It is often difficult to find the right size for the frame and because of this it may be necessary to use the scroll bars to see the entire contents of the frame. In addition, the visitor of your site may have a low screen resolution, which will also lead to the appearance of scroll bars. The most unpleasant drawback of frames is that some search engines and directories refuse to register sites that use frames.

Frames are created using the <FRAMESET> and <FRAME> tags.

  • <FRAMESET> - allows you to create a set of frames that divide the space of the workspace into columns and rows.
  • In the <FRAMESET> descriptor, you must determine the width of the height of all rows and columns. Values ​​are specified in pixels, percentages, or with the asterisk symbol - this indicates that the dimensions are determined relative to the rest of the page frames.
  • <FRAME> - defines the contents and structure of a particular frame. The required frame attribute is the "src" attribute. It specifies the source for the contents of the frame.

Example of using frames:

<html>
<head>
<title> Example of using frames </ title>
</ head>
<frameset rows = "300,100">
<frame name = "1" src = "1.html">
<frame name = "2" src = "2.html">
</ frameset>
</ html>

By default, the scroll bars in the frame appear only when the content of the source does not fit into the frame. However, you can disable the scrolling of the scrolling scales using the scrolling attribute. This attribute can take the values yes and no . To prevent the frame from being resized, use the noresize attribute. This prevents the user from changing the appearance of the page. By default, the frame frame width is 6 pixels. You can change the width of the frame or remove it at all with the border attribute and frameborder .

In order to set the fields inside the frames, you need to use the marginwidth and marginheight attributes for the left / right margins and the upper / lower margins, respectively.

In addition to normal frames, you can use a floating frame to insert the contents of another page onto the page. It is created by the <IFRAME> tag and does not require a separate page describing the structure of the frames. You can create a floating frame anywhere on the page and set its size with the width and height attributes.