Cover Image for HTML iframe Tag
71 views

HTML iframe Tag

The <iframe> tag is an HTML element used to embed another HTML document or web page within the current document. It stands for “inline frame.” The content within the <iframe> tag is displayed as a separate browsing context within the current web page.

Here’s an example of how the <iframe> tag is used:

HTML<span role="button" tabindex="0" data-code="<!DOCTYPE html> <html> <head> <title>My Web Page</title> </head> <body> <h1>Welcome to My Web Page</h1> <p>Here is an embedded web page:</p> <iframe src="https://www.example.com" width="500" height="300"></iframe> </body>
<!DOCTYPE html>
<html>
     <head>
          <title>My Web Page</title>
     </head>
     <body>
          <h1>Welcome to My Web Page</h1>
          <p>Here is an embedded web page:</p>
          <iframe src="https://www.example.com" width="500" height="300"></iframe>
     </body>
</html>

In this example, the <iframe> tag is used to embed the web page located at “https://www.example.com” within the current document. The src attribute specifies the URL of the page to be loaded within the <iframe>. The width and height attributes determine the dimensions of the <iframe> element.

By default, the content within the <iframe> tag is displayed as a rectangular box on the web page. The browser fetches and renders the embedded page within this box. Users can interact with the embedded content, scroll within it, and follow links contained within the embedded page.

The <iframe> tag supports various attributes and options to control its behavior, such as sandbox for enhanced security, allowfullscreen for enabling fullscreen mode, and more. You can also use CSS to style and position the <iframe> element on your web page.

It’s important to note that when embedding content from external sources, like another website, you should ensure that you have proper permissions and that the embedded content adheres to applicable usage policies.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS