Description of iframe, frame, and frameset attributes in the html framework, iframeframeset
Problem
1. Do you know the difference between iframe and frame?
2. Have you used frameset and other related attributes?
Differences between iframe and frame
I don't know if you have used the frameset attribute in the project. The frameset attribute was used in an online customer service system last year, because the customer service system must have a fixed layout, the following is the frame set and frame used at the time. After I used up these attributes, I realized the difference between iframe and frame. Before that, I usually didn't use a framework in my project. iframe was used in actual use.
Let's talk about the specific differences! The following points are summarized.
1. frame cannot be used independently from frameSet, and iframe can;
2. frame cannot be placed in the body;
As shown below:
<!--<body>--> <frameset rows="50%,*"> <frame name="frame1" src="test1.htm"/> <frame name="frame2" src="test2.htm"/> </frameset> <!--<body>-->
The following cannot be displayed normally:
<body> <frameset rows="50%,*"> <frame name="frame1" src="test1.htm"/> <frame name="frame2" src="test2.htm"/> </frameset> <body>
On the contrary, if iframe is placed under the frameSet attribute, it must be placed in the body.
<body> <frameset> <iframe name="frame1" src="test1.htm"/> <iframe name="frame2" src="test2.htm"/> </frameset> </body>
3. iframe is an html tag, which can be used anywhere in html, but not frame.
<body> <iframe name="frame1" src="test1.htm"/> <iframe name="frame2" src="test2.htm"/> </body><table> <tr> <td><iframe id="" src=""></iframe></td><td></td> </tr> </table>
Frame must be nested in frameSet and cannot be used in tables or other labels.
4. The frame height can only be controlled by frameSet; iframe can be controlled by itself, but cannot be controlled by frameSet.
<!--<body>--> <frameset rows="50%,*"> <frame name="frame1" src="test1.htm"/> <frame name="frame2" src="test2.htm"/> </frameset> <!--</body>--> <body> <frameset> <iframe height="30%" name="frame1" src="test1.htm"/> <iframe height="100" name="frame2" src="test2.htm"/> </frameset> </body>
5. If more than two iframe files are used on the same page, they can be normally displayed in IE, and only the first one can be displayed in firefox; use more than two frames in IE and firefox.
Introduction to frameset attributes
BorderSet the Border width of the frame.
BordercolorSet the border color of the frame.
FrameborderSet whether to display the frame border. The set values are only 0 and 1. 0 indicates no border, and 1 indicates that the border is to be displayed.
Cols
Vertically split the page. There are three numeric Representation Methods: 30%, 30 (or 30px), and ". The number of numeric values indicates the number of windows to be divided and the values are separated. "30%" indicates that the frame area occupies 30% of all browser page areas; "30" indicates that the horizontal width of the area is 30 pixels; "" indicates that the area occupies the remaining page space. For example, cols = "25%, 200, *" indicates that the page is divided into three parts, the left part occupies 25% of the page, the middle horizontal width is 200 pixels, and the remaining part of the page is the right part.
RowsSplit the page horizontally. The numeric representation method has the same meaning as cols.
FramespacingSet the gap between the framework and the framework.
Usage
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The layout and js selection sections are as follows:
I am an original post for the haorooms front-end blog! Reprinted please note! Source Address is http://www.haorooms.com/post/html_frameset_contro