Home > Web Front-end > HTML Tutorial > What is the use of introducing HTML frames (Frames)?

What is the use of introducing HTML frames (Frames)?

零下一度
Release: 2017-05-02 15:16:28
Original
2906 people have browsed it

Using Frame, you can display multiple web pages in the browser window at the same time. A web page is set in each Frame, and the web pages in each Frame are independent of each other.

Frameset

Determines how to divide the Frame. has cols attributes and rows attributes. Use the cols attribute to distribute the Frame by columns; use the rows attribute to distribute the Frame by rows.

Frame

Use the tag to set the web page. There is a src attribute in , and the src value is the path and file name of the web page.

The purpose of the following code is to divide the Frameset into 2 columns. The first column is 25%, which means the width of the first column is 25% of the window width; the second column is 75%, which means the width of the first column. is 75% of the window width. a.html is displayed in the first column and b.html is displayed in the second column.

<frameset cols="25%,75%">
   <frame src="../asdocs/html_tutorials/Frame_a.html">
   <frame src="../asdocs/html_tutorials/Frame_b.html">
</frameset>
Copy after login

Iframe

Iframe means Inline Frame. Use to place the Frame within an HTML file.

Example

<html>

<frameset cols="25%,50%,25%">

<frame src="../asdocs/html_tutorials/Frame_a.html">
<frame src="../asdocs/html_tutorials/Frame_b.html">
<frame src="../asdocs/html_tutorials/Frame_c.html">

</frameset>

</html>
Copy after login

This example shows how to display three web pages at the same time in the browser. The three web pages are distributed in columns.

<html>

<frameset rows="25%,50%,25%">

<frame src="../asdocs/html_tutorials/Frame_a.html">
<frame src="../asdocs/html_tutorials/Frame_b.html">
<frame src="../asdocs/html_tutorials/Frame_c.html">

</frameset>

</html>
Copy after login

This example shows how to display three web pages at the same time in the browser. The three web pages are distributed in rows.

Mixed Frameset

<html>

<frameset rows="50%,50%">

<frame src="../asdocs/html_tutorials/Frame_a.html">

<frameset cols="25%,75%">
<frame src="../asdocs/html_tutorials/Frame_b.html">
<frame src="../asdocs/html_tutorials/Frame_c.html">
</frameset>

</frameset>

</html>
Copy after login

This example uses both the cols attribute and the rows attribute to flexibly distribute the Frame.

The noresize attribute in Frameset

<html>

<frameset rows="50%,50%">

<frame noresize="noresize" src="../asdocs/html_tutorials/Frame_a.html">

<frameset cols="25%,75%">
<frame noresize="noresize" src="../asdocs/html_tutorials/Frame_b.html">
<frame noresize="noresize" src="../asdocs/html_tutorials/Frame_c.html">
</frameset>

</frameset>

</html>
Copy after login

Use the Noresize attribute to ensure the size of the Frame. If the noresize attribute is not used, you can use the mouse to move the border of the Frame to change the size of the Frame. If the noresize attribute is set, the border cannot be moved.

Frame for navigation

<html>
<frameset cols="120,*">

<frame src="../asdocs/html_tutorials/framelist.html">
<frame src="../asdocs/html_tutorials/Frame_a.html" name="showframe">

</frameset>
</html>
Copy after login

This example demonstrates how to create a Frame for navigation. This navigation Frame contains an HTML, and this HTML (code below) contains a list of web pages. Click on any item in the web page list, and the clicked web page will be displayed in the second Frame.

<HTML>
<HEAD>
<TITLE> humorlist.html </TITLE>
</HEAD>
<BODY>
<p><a href = "../asdocs/html_tutorials/Frame_a.html" target="showframe">笑话一<a></p>
<p><a href = "../asdocs/html_tutorials/Frame_b.html"  target="showframe">笑话二<a></p>
<p><a href = "../asdocs/html_tutorials/Frame_c.html"  target="showframe">笑话三<a></p>
</BODY>
</HTML>
Copy after login

Usage of Iframe

<html>
<body>
<p>用 IFRAME 可以在HTML文件里显示另一个网页。</p>

<p>这个 HTML 文档中使用 IFRAME 来显示另外一个叫Frame_a.html 的网页。</p>

<iframe src="../asdocs/html_tutorials/Frame_a.html"></iframe>

</body>
</html>
Copy after login

This example shows how to use iframe to embed a web page in an HTML file.

The above is the detailed content of What is the use of introducing HTML frames (Frames)?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template