HTML frame
Definition and usage
<frame> tag defines a specific window (frame) in the frameset.
Each frame in the frameset can set different properties, such as border, scrolling, noresize, etc.
Differences between HTML and XHTML
In HTML, the <frame> tag does not have a closing tag.
In XHTML, the <frame> tag must be closed properly.
Tips and Notes:
Note: If you wish to validate pages containing frames, make sure the doctype is set to "Frameset DTD". Read more about DOCTYPE.
Important: You cannot use the <body></body> tag with the <frameset></frameset> tag. However, if you need to add a <noframes> tag for browsers that don't support frames, be sure to place the tag within the <body></body> tag!
Iframe - Set height and width
##The height and width attributes are used to define the height and width of the iframe tag. The property defaults to pixels, but you can specify that it be displayed proportionally (e.g.: "80%").<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> </head> <body> <iframe src="demo_iframe.htm" width="200" height="200"></iframe> <p>一些旧的浏览器不支持 iframe。</p> <p>如果浏览器不支持 iframes 则不会显示。</p> </body> </html>
Iframe - Remove borders
The frameborder attribute is used to define whether the iframe indicates whether to display the border. Set the attribute value to "0" to remove the border of the iframe:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> </head> <body> <iframe src="http://www.php.com" width="200" height="200" frameborder="0"> <p>您的浏览器不支持 iframe 标签。</p> </iframe> </body> </html>
Use iframe to display the directory link page
iframe can display a target link pageThe attributes of the target link must use the attributes of iframe, as shown in the following example:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> </head> <body> <iframe src="demo_iframe.htm" name="iframe_a"></iframe> <p><a href="http://www.php.com" target="iframe_a">php.cn</a></p> <p><b>注意:</b> 因为 a 标签的 target 属性是名为 iframe_a 的 iframe 框架,所以在点击链接时页面会显示在 iframe框架中。</p> </body> </html>