Home > Article > Web Front-end > How to use HTML iframe tag? Introduction to usage examples of HTML iframe tags
This article mainly introduces the details of the definition and use of iframe tags in HTML, as well as the attributes, advantages and disadvantages of HTML iframe tags. Let's take a look now
First let's take a look at the meaning of the HTML iframe tag:
The iframe tag creates an inline frame that contains another document (i.e. inline frames).
Let’s take a look at the attribute introduction of the iframe tag:
Here are some examples:
<iframe src="http://www.php.cn" width="200" height="500"> 这里使用了框架技术,但是您的浏览器不支持框架,请升级您的浏览器以便正常访问。 </iframe>
Use pixels to define the size of the iframe
<iframe src="http://www.php.cn" width="20%" height="50%"> 这里使用了框架技术,但是您的浏览器不支持框架,请升级您的浏览器以便正常访问。 </iframe>
Use percentages to define the size of the iframe
html Advantages and disadvantages of iframe
Advantages: When reloading a page, you do not need to reload the entire page, only a frame page in the page needs to be reloaded (reduce data transmission and reduce the loading time of the web page);
The technology is simple and easy to use. It is mainly used for pages that do not require search engines to search;
Convenient development and reduce code duplication rate (such as the header and footer of the page);
Disadvantages: It will generate a lot of pages, which is not easy to manage;
is not easy to print;
Multi-frame pages will increase the number of service http requests;
Browse The back button of the browser is invalid, etc.;
html Use of iframe tag:
iframe tag, also called floating frame tag, you can use it to embed an HTML document in Displayed in an HTML.
The biggest feature that is different from the frame tag is that the HTML file referenced by this tag is not displayed independently from other HTML files
, but can be directly embedded in an HTML file, with The content of this HTML file is integrated with each other and
becomes a whole. In addition, the same content can be displayed multiple times on a page without having to write the content repeatedly.
An image metaphor is "painting" In the picture "TV.
The usage format of iframe tag is:
src: The path of the file, which can be an HTML file, text, ASP, etc.;
width, height: "In the picture Draw the width and height of the area;
scrolling: When the specified HTML file of SRC is not displayed in the specified area, the scrolling option,
If set to NO, it will not appear. Scroll bar; if it is Auto: the scroll bar will appear automatically; if it is Yes, it will be displayed;
frameBorder: the width of the area border. In order to integrate the "picture-in-picture" with adjacent content, it is often set to 0.
For example:
<Iframe src="http://www.php.cn/" width="250" height="200" scrolling="no" frameborder="0"></iframe>
[Editor’s recommendation]
How to write a relative path for the base tag in HTML? (Introduction to use included)
#html How to use the base tag? How to use the base tag (with examples)
The above is the detailed content of How to use HTML iframe tag? Introduction to usage examples of HTML iframe tags. For more information, please follow other related articles on the PHP Chinese website!