iframes in HTML
With the help of iframes in HTML, the developer can inline frame with the HTML tag <iframe>. The <iframe> tag is not related to <frameset> tag (frameset tag is not supported in HTML5), instead, This tag can appear anywhere in your document. The <iframe> tag defines a rectangular section within the document in which the browser can show a separate document, including scrollbars and borders. An inline frame is used to connect another document within the current HTML document. If you want to learn how to use these features practically , or HTML Online Traning will help you
<html> <head> <title> iframes in HTML</title> </head> <body> <p>Document goes here...</p> <iframe src = "/html/menu.htm" width = "550" height = "250"> Sorry your browser does not support inline frames. </iframe> </body> ></html>
The <Iframe> Tag Attributes
Most of the attributes of the <iframe> tag, such as name, class, frameborder, id, longdesc, marginheight, marginwidth, name, scrolling, style, and title correlate with the attributes of the <frame> tag.
Note − The frameborder, marginwidth, longdesc, scrolling, marginheight attributes does not supported in HTML5..
The src attribute is used to give the location of the file that should be loaded in the frame. For example, src = "/html/top_frame.htm" will load an HTML file available in html directory.
The name attribute allows you to give a name to a frame. This tag is used to indicate that the document should be loaded into which frame. This attribute is important when you want to create links in one frame that link load pages into another frame, In which case the second frame needs a name for its identification as the target of the link.
The frameborder attribute specifies if the borders of that frame are shown or not, it disapproves the value given in the frame border attribute on the <frameset> tag if one is given, and this tag can take values either 1 (yes) or 0 (no).
The marginwidth attribute allows you to specify the width of the space between the left and right sides of the frame's borders and the frame's content also. The value is given in pixels.
The marginheight attribute specifies the height of the space between the top and bottom of the frame's borders and contents. The value is given in pixels.
The height attribute specifies the height of <iframe>.
The width attribute specifies the width of <iframe>.
The scrolling attribute controls the appearance of the scrollbars that appear on the frame. This attribute takes values either "yes", "no" or "auto".
The longest attribute allows you to provide a link to another page that contains a long description of the contents of the frame.
In this article, we learned about iframes in HTML, in simple words This tag can appear anywhere in your document. <iframe> tag defines a rectangular section within the document in which the browser can show a separate document, including scrollbars and borders, and apart from that we also learned about each attribute of HTML frames in detail. Click on HTML Certification in order to learn more.
Take our free html skill challenge to evaluate your skill
In less than 5 minutes, with our skill challenge, you can identify your knowledge gaps and strengths in a given skill.