Home >Web Front-end >HTML Tutorial >HTML frame tags frameset, frame, iframe, noframes

HTML frame tags frameset, frame, iframe, noframes

高洛峰
高洛峰Original
2017-02-13 15:19:522271browse

Generally, only one web page file can be displayed in a browser document window. However, using the frame tag, a browser document window can be divided into multiple sub-windows, and an independent web page file can be displayed in each sub-window.
Frame is translated from English Frame, which represents a sub-window in the browser document window. Each frame can display an HTML file, and multiple frames form a frameset (Frameset). The usual way to use a frameset is to place a web page in a frame. This web page contains hyperlink entries that can link to multiple other web pages. After the visitor clicks on these hyperlink entries, the web page file pointed to by the hyperlink can be displayed in the in another specified frame. Frames can be used if more than one web page is required to be displayed in a single application window.


1. Frameset tag…

A window area divided into several frames is called a frameset, and the frame window must be defined in In a frameset, the and tags are used to define how many frames there are in the frameset and how each frame is arranged.
and tags are nested in the tag pair. They can also be nested, but must be placed in and tags, because the and tags are only used to divide the frame window and cannot display other web page elements.
The tag has two important attributes, rows and cols. When using this tag, at least one of these two attributes should be selected, otherwise the browser will only display the first defined frame, and the remaining The and tags will not play any role.
The rows attribute is used to specify how many rows of frame windows and the size of each frame window and each frame window in the main document.

The cols attribute is used to specify how many columns of frame windows and the size of each frame window and each frame window in the main document.

Attribute value can be percentage or absolute pixel value. Or a combination of asterisks (*), the number of values ​​indicates the number of rows and columns, (*) represents those unspecified spaces, if multiple asterisks (*) appear in the same attribute, then The remaining unspecified space is divided equally, with each value separated by commas.

Example: This means there are three frames arranged in rows, each frame occupies the entire browser window

1/ 3 size of space.

This means there are three frames arranged in columns. The first frame occupies 40% of the entire browser window. The remaining space is divided equally between the other two frame windows.

This means there are six frames in total, two rows and three columns

2. Frame tag

tag is placed between the and tags to define A specific frame window. The tag has two important attributes, the src and name attributes, both of which must be assigned values. src specifies the URL address of the web page file initially loaded in the entire frame window. The browser will display the HTML file specified by src in this frame; name specifies the name of the frame window. This name is used for hypertext link tags specifies the frame in which the linked HTML file will be displayed. For example, if a frame name is defined as main, and the target attribute value of the hyperlink tag in another frame window is equal to the name of this frame window, main, when the hyperlink is clicked, the HTML file it points to will be displayed in main. in the frame.
In addition, also has scrolling and noresize attributes. scrolling is used to specify whether to display scroll bars in the frame window border. The values ​​can be yes, no, or auto (displayed when the space of the web content is larger than the space window. Otherwise it will not be displayed). The noresize attribute can be used directly by adding a tag without assigning a value. It is used to prohibit users from using the mouse to drag the dividing lines between frames to adjust the size of the frames.

3. Tags </p> <p><noframes> and are used when the browser used by the viewer is too old. , when the frame function is not supported, what you see will be blank. In order to avoid this situation, you can use the tag. When the browser you are using cannot see the frame, you will see the content between <noframes>... instead of a blank space. . These contents can be text that reminds browsing to switch to a new browser, or even a web page without frames, or it can automatically switch to a version without frames. Between this tag pair, the and tags should follow immediately.

4. Floating window label

tags do not need to be placed between the and tags. Their function is to insert a simple frame window in the middle of a web page. In this frame window, you can Display another file, so that a "picture-in-picture" effect can be achieved. The text placed in the tag pairs will only be displayed if the browser does not support the