A frame divides a browser window into multiple independent panes, each of which contains an independent HTML page.
1. Basic concepts of framework
Users can load or reload individual pane content through frames without reloading the entire content of the browser window. Relative to frames, the set of frames corresponding to the entire browser window is called a frameset.
In HTML, use the frameset tag <frameset> to divide the frame of the page, and use the attribute rows (or cols) to indicate the number of rows (or columns) of the frame and the proportion of the window it occupies.
The role of the window frame:
It is to divide the web page into multiple HTML pages, that is, to divide the window screen into multiple small windows, and in each small window, different web pages can be displayed, and in the browser, a complete page is formed, so that in the browser The effect of browsing different web pages at the same time.
The biggest features of frame web pages:
Without changing the layout of the entire page, the HTML pages can be linked to each other to achieve the purpose of obtaining the required content without turning the page. This feature largely makes it unique in displaying electronic documents. Unique advantage.
2. Frameset tags
Basic syntax:
<frameset>
<frame>
<frame>
…
</frameset>
Syntax explanation: A frameset is an HTML page that defines a set of frame structures within a document. There is no <BODY> tag in this page. Framesets define the number, size, and loading pages of frames displayed in a window.
Note 1: The window frame component defined by the <Frameset> tag is equivalent to the file theme component defined by the <BODY> tag. Therefore, the <Frameset> tag cannot be included in the <BODY> tag, otherwise the <Frameset> tag will not work properly. use.
Note 2: The <Frame> tag is used to define a sub-window. Since there is no end tag, the tag is only used to set various attributes in the tag to control the window frame it represents.
(1) Left and right split window attributes Cols
Basic syntax:
<frameset cols="value,value,...">
<frame>
<frame>
…
</frameset>
Syntax explanation: Value defines the width value of each frame. The unit can be pixels or percentages.
<html><head><title>dotcpp</title></head><framesetcols=30%,70%><frame><frame></frameset></html>
The effect is as shown in the figure:
(2) Upper and lower split window attributes Rows
Basic syntax:
<frameset rows="value,value,...">
<frame>
<frame>
…
</frameset>
Syntax explanation: Value defines the width value of each frame. The unit can be pixels or percentages.
<html><head><title>dotcpp</title></head><framesetrows=20%,*,20%><frame><frame><frame></frameset></html>
The effect is as shown in the figure:
(3) Nested split windows
Basic syntax:
<frameset cols="value,value,...">
<frame>
<frameset rows="value,value,...">
<frame>
<frame>
…
</frameset>
<frame>
…
</frameset>
Syntax explanation: Splits can be nested.
<html><head><title>Nested split windows</title></head><framesetcols=*,*><framesetrows=*,*><frame><frame></frameset><framesetrows=*, *><frame><frame></frameset></frameset></html>
The effect is as follows:
(4) Frameset border width attribute FrameSpacing
Basic syntax:
<frameset FrameSpacing="VALUE">
Syntax explanation: Set the border width of the frameset in pixels.
(5) Frame set border color attribute Bordercolor
Basic syntax:
<frameset BorderColor="COLOR_VALUE">
Syntax explanation: Set the border color of the frameset.
3. Frame tag <Frame>:
(1) Frame page source file attribute SRC
Basic syntax:
<frame src="FILE_NAME">
Syntax explanation: Each frame has a displayed web page, and the SRC attribute sets the file path of the frame page.
(2)Frame name attribute Name
Basic syntax:
<frame src="FILE_NAME" name="Frame_name">
Syntax explanation: You can name each link. The name is used for the link and script description of the page and does not affect the display of the page.
Naming rules: A single word can have an underscore "_", must start with a letter, and is case-sensitive.
(3) Frame border display property FrameBorder
Basic syntax:
<frame src="FILE_NAME" frameborder="VALUE">
Syntax explanation: If VALUE is 0, the border will not be displayed, and if it is 1, the border will be displayed.
Note 1: The Frameborder property can be used to control the surroundings of the window frame and whether to display the frame.
Note 2: This attribute can be used in the <Frameset> tag and the <Frame> tag. When used in the <Frameset> tag, it can control all child windows of the window frame. When used in the <Frame> tag, only the sub-window represented by the tag can be controlled.
Note 3: 0 means not to display the frame line, 1 means to display the frame line, and its default value is 1.
(4) Frame scroll bar display property Scrolling
Basic syntax:
<frame src="FILE_NAME" scrolling="VALUE">
Syntax explanation: If the VALUE value is YES, the scroll bar will be displayed, if it is NO, the scroll bar will not be displayed, and if it is AUTO, it will automatically determine whether to display the scroll bar based on the page length.
(5) Frame size adjustment attribute NoResize
Basic syntax:
<frame src="FILE_NAME" NoResize>
Syntax explanation: NORESIZE prohibits changing the size of the frame.
(6) Frame edge width attribute MarginWidth
Basic syntax:
<frame src="FILE_NAME"
MarginWidth="value">
Syntax explanation: MarginWidth sets the left and right margins of the frame.
(7) Frame edge height attribute MarginHeight
Basic syntax:
<frame src="FILE_NAME"
MarginHeight="value">
Syntax explanation: MarginHeight sets the top and bottom margins of the frame.
4. Frame tags are not supported
For use with browsers that do not support frame technology.
Basic syntax:
<frameset cols="value,value,...">
<frame>
<frame>
…
<Noframes>
…
</Noframes>
</frameset>
5. Floating frame
A floating frame is a special frame page that nests sub-windows in the browser window and then displays the page content in it.
Basic syntax: <IFRAME>……</IFRAME>
6. Frames and links
An important purpose of using frames is to display different pages in different frames.
Mainly through the link's "Target " attribute to set the frame and window in which the linked page is displayed.