search
HomeWeb Front-endHTML TutorialWhat is the use of introducing HTML frames (Frames)?

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>

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>

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>

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>

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>

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>

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>

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>

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!

Statement
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
How do you insert an image into an HTML page?How do you insert an image into an HTML page?May 04, 2025 am 12:02 AM

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

HTML's Purpose: Enabling Web Browsers to Display ContentHTML's Purpose: Enabling Web Browsers to Display ContentMay 03, 2025 am 12:03 AM

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

Why are HTML tags important for web development?Why are HTML tags important for web development?May 02, 2025 am 12:03 AM

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.

Explain the importance of using consistent coding style for HTML tags and attributes.Explain the importance of using consistent coding style for HTML tags and attributes.May 01, 2025 am 12:01 AM

A consistent HTML encoding style is important because it improves the readability, maintainability and efficiency of the code. 1) Use lowercase tags and attributes, 2) Keep consistent indentation, 3) Select and stick to single or double quotes, 4) Avoid mixing different styles in projects, 5) Use automation tools such as Prettier or ESLint to ensure consistency in styles.

How to implement multi-project carousel in Bootstrap 4?How to implement multi-project carousel in Bootstrap 4?Apr 30, 2025 pm 03:24 PM

Solution to implement multi-project carousel in Bootstrap4 Implementing multi-project carousel in Bootstrap4 is not an easy task. Although Bootstrap...

How does deepseek official website achieve the effect of penetrating mouse scroll event?How does deepseek official website achieve the effect of penetrating mouse scroll event?Apr 30, 2025 pm 03:21 PM

How to achieve the effect of mouse scrolling event penetration? When we browse the web, we often encounter some special interaction designs. For example, on deepseek official website, �...

How to modify the playback control style of HTML videoHow to modify the playback control style of HTML videoApr 30, 2025 pm 03:18 PM

The default playback control style of HTML video cannot be modified directly through CSS. 1. Create custom controls using JavaScript. 2. Beautify these controls through CSS. 3. Consider compatibility, user experience and performance, using libraries such as Video.js or Plyr can simplify the process.

What problems will be caused by using native select on your phone?What problems will be caused by using native select on your phone?Apr 30, 2025 pm 03:15 PM

Potential problems with using native select on mobile phones When developing mobile applications, we often encounter the need for selecting boxes. Normally, developers...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function