search
HomeWeb Front-endHTML TutorialHow to use HTML framework

How to use HTML framework

Jun 04, 2018 pm 03:40 PM
htmlhowframe

A browser document window can only display one web page file, but you can display more than one page in the same browser window by using frames. This article will introduce the HTML frame

1. Frame

A browser document window can only display one web page file, but you can display more than one page in the same browser window by using frames. Pages that use frames mainly include two parts, one is the frame set, and the other is the specific frame file.

Frames are mostly used for the layout of website backends or intranet systems.

1. Frame set (): is a file used to define this HTML document as a frame mode and set how the window is divided. In layman's terms, a frameset is a file that stores the frame structure and is also an entry file for accessing frame files. If a web page consists of two left and right frames, then in addition to the two left and right web page files, there is also a general frame set file. In pages that use frames, the

tag is replaced by the frame tag . Each frame contained in the frame page is defined through the tag.

rows attribute: Split the window horizontally. Horizontally split windows are to cut the page in the horizontal direction, that is, to divide the page into multiple windows arranged up and down. Rows can take multiple values, each value represents the horizontal width of a frame window, and its unit can be pixels or a percentage of the browser. However, it should be noted that generally when several rows values ​​are set, several frames are required, that is, a corresponding number of parameters are required.

  <html>
  
  <head>
  
  <title>水平分割窗口的效果</title>
  
  </head>
  
 <frameset rows="30%,70%">
 
     <frame>
 
     <frame>
 
 </frameset>
 
 </html>

cols attribute: vertically split window. Vertically splitting a window means dividing the page into multiple windows in the vertical direction, that is, dividing the page into multiple windows arranged left and right. cols can take multiple values, each value represents the horizontal width of a frame window, and its unit can be pixels or a percentage of the browser. Similar to the horizontal split window, generally setting several cols values ​​requires several frames, that is, several parameters.

  <html>
  
  <head>
  
  <title>垂直分割窗口的效果</title>
  
  </head>
  
<frameset cols="20%,55%,25%">
 
     <frame>
 
     <frame>
 
     <frame>
 
 </frameset>
 
 </html>

frameborder attribute: Set the border. By default, there is a border line around the frame window, and the display of the border line can be adjusted through the frameborder parameter. The syntax is:

or . The value of frameborder can only be 0 or 1. If the value is 0, the border line will be hidden; if the value is 1, the border line will be displayed. Setting it in frameset will be effective for the entire frame, and setting it in frame will be effective only for the current frame.
  <html>
  
  <head>
  
  <title>设置框架窗口的边框显示效果</title>
  
  </head>
  
  <frameset rows="20%,55%,25%">
 
 <frame frameborder="1">
 
 <frameset cols="35%,65%" frameborder="0">
 
 <frame >
 
 <frame>
 
 </frameset>
 
 <frame frameborder="0">
 
 </frameset>
 
 </html>

framespacing attribute: The border width of the frame. The border width of the frame is 1 pixel by default, and its size can be adjusted through the parameters framespacing.

Syntax:

Description: The frame width is the width of the lines between the borders on the page, in pixels. This parameter can only be used for framesets and is not valid for a single frame.

  <html>
  
  <head>
  
  <title>设置框架的边框宽度</title>
  
  </head>
  
 <frameset rows="30%,70%" framespacing="10">
     <frame>
 
       <frameset cols="20%,55%,25%" framespacing="30">
 
         <frame>
 
         <frame>
 
         <frame>
 
       </frameset>
 
 </frameset>
 
 </html>

bordercolor property: The border color of the frame. Use the parameter bordercolor to set the border color of the frameset.

Syntax:

Description: This parameter is also only valid for the entire frameset, not for a single frame.

  <html>
  
  <head>
  
  <title>设置框架的边框颜色</title>
  
  </head>
  
 <frameset rows="30%,70%" framespacing="10" bordercolor ="#CC99FF">
 
     <frame>
 
      <frameset cols="20%,55%,25%" framespacing="30" bordercolor ="#9900FF">
 
         <frame>
 
         <frame>
 
         <frame>
 
       </frameset>
 
 </frameset>
 
 </html>

2. Frame () and src attributes.

Each page in the frame structure is a separate text, and these files are set through the src parameter.

Syntax:

Description: The page file is where the specific content of the frame page is located. For frames that do not have a source file set, it is just blank. The page has no effect. The source file of the page can be a normal HTML file, or it can be an image or other file.

  <html>
  
  <head>
  
  <title>设置页面源文件</title>
  
  </head>
  
 <frameset rows="30%,70%">
 
     <frame src="pic01.gif">
     <frame src="src01.html">
 
 </frameset>
 
 </html>

3. tag

## tag is used to display when the browser does not support frames Page content.

  <html>
 <frameset cols="25%,50%,25%">
    <frame src="/example/html/frame_a.html">
    <frame src="/example/html/frame_b.html">
    <frame src="/example/html/frame_c.html">
  <noframes>
  <body>您的浏览器无法处理框架!</body>
  </noframes>
  </frameset>
 </html>

2. Floating frame (

The floating frame is a more special frame, which is used in the browser There are sub-windows nested in the window, that is, the entire page is not a frame page, but it contains a frame window. Display the corresponding page content within the frame window. Floating frames are also called inline frames, and hence the name.

Syntax:

Description: Similar to the ordinary frame structure, the floating frame can also set many parameters, such as name, scrolling, frameborder, etc. But compared with ordinary frames, floating frames do not contain framespacing and bordercolor parameters.

src属性:浮动框架中最基本的参数就是src,它用来设置浮动框架页面的源文件地址,也是浮动框架页面必需的参数。因为只有设置了源文件的内容,浮动框架才有意义。语法:

width和height属性:在普通框架结构中,由于框架就是整个浏览器窗口,因此不需要设置其大小。但是在浮动框架中,是插入到普通HTML页面中的,可以调整整个框架的大小。语法:

 <html>
 <body>
<iframe src="/i/eg_landscape.jpg" width="550" height="310" ></iframe>
 <p>一些老的浏览器不支持 iframe。</p>
 <p>如果得不到支持,iframe 是不可见的。</p>
 </body>
 </html>

三、一个框架布局的示例

  <html>
  <head>
      <title>框架主页面 </title>
  </head>
 <frameset rows="20%,*"><!--框架集,控件文件的容器-->
      <frame name="topFame" src="3.html" noresize/>
        <frameset cols="240px,*">
            <frame name="leftFrame" src="1.html"/>
      <frame name="rightFrame" src="2.html" marginwidth="20px" scrolling="no"/>
             
         </frameset>
        <noframes>
        <!--noframes标记当中可以包含body标记-->
         <body> 
             该页面不支持frameset标签!
         </body>
     </noframes>
  </frameset>
 </html>

 四、链接如何跳出框架

在网站后台布局中,框架用得比较多。在很多时候,我们需要跳出框架,重新加载页面。那么链接如何才能跳出框架呢?其实,只需要指定标签的target属性为"_top"即可实现。下面是一个简单的例子。

  <html>
  
  <body>
  
  <p>被锁在框架中了吗?</p> 
  
  <a href="/index.html"
  target="_top">请点击这里!</a> 
  
 </body>
 </html>

总结:以上就是本篇文的全部内容,希望能对大家的学习有所帮助。

相关推荐:

HTML框架标签的作用总结

HTML框架标签的实例应用

HTML框架标签frameset、frame、iframe、noframes

 介绍HTML框架(Frames)到底有什么用?

The above is the detailed content of How to use HTML framework. 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
The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

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

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)