1.Definition
iFrame, short for inline frame, is a component of the HTML element that allows documents, videos, and interactive media to be embedded in pages. By doing this, a secondary page can be displayed on the main page.
The iFrame element allows the inclusion of content from other sources. It can integrate content anywhere on the page without having to include the content within the structure of the web layout like traditional elements.
But excessive use of iFrames can slow down your page and pose security risks. Treat iFrames as part of the content, not part of the site. For example, if you want to add an iQiyi video to engage readers, you can insert an iFrame element into the article.
The syntax format of the <iframe> tag is as follows:
<iframesrc=urlwidth=mheight=n></iframe>
The src attribute is used to specify the address of the web page to be embedded; the width and height attributes are used to specify the width and height of the frame. The default unit is pixels, of course you can also use percentages.
Note: The HTML <iframe> tag is not conducive to search engines crawling page content, has a negative effect on SEO, and is not recommended for use in modern web design.
2. How to use iFrame
You can insert an iFrame element in an HTML document using the <iFrame> tag. Copy the following code and paste it into Notepad, and save the file in .html format.
All attributes of the <iframe> tag are as follows:
Example:
<!DOCTYPEhtml><html><head><metacharset=utf-8><title>HTML<iframe> tag demonstration</title></head><body><p>The following inline frame will be embedded in the C language network For the homepage, the width is set to 330 pixels and the height is set to 580 pixels to simulate the display effect of the mobile phone. </p><iframesrc=width=330height=580></iframe></body></html>
The displayed effect is as follows: