How to insert iframe tag in HTML?

Generally during the development of a web page, there may be a need to display another document in your main document and as a result, this document can be embedded into the main document with the help of iframe tag. The iframe tag is not somehow related to frameset tag. It can appear anywhere in your document. The iframe tag defines a rectangular region within the document in which the browser can display a separate document, including scrollbars and borders. An inline frame is used to embed another document within the current HTML document.

The src attribute is used to specify the URL of the document that occupies the inline frame. Here is the example of iframe tag.

<!DOCTYPE html>
<html>
<head>
<title>Example of Iframes in HTML</title>
</head>
<body>
<p>Let us embed a document inside another document</p>
<iframe src = "https://programmingtutorial.in/category/c/" width = "500" height = "200">
Sorry your browser does not support inline frames.
</iframe>
<p>Document content also go here...</p>
</body>
</html>

The above code embeds external page in main document. The height and width of frame is 400 and 200 respectively. Copy this code and paste in notepad then open with browser to get the result.

iframes