Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

HTML – Iframes

An Iframe (short for “inline frame”) is an HTML element that allows you to embed another HTML document within the current document. It is commonly used to embed external content, such as videos, maps, or other web pages, into a webpage.

Here’s an example of how to use an iframe:



  My Webpage

Welcome to My Webpage

Some text here...

In the example above, we have an iframe element that embeds the external website “https://phpgurukul.com” within our webpage.

The src attribute specifies the URL of the content you want to embed. It can be a link to an external webpage or the path to a local HTML file.

Here are some commonly used attributes for iframes:

  • src: Specifies the URL of the content to be embedded.
  • width: Specifies the width of the iframe in pixels or as a percentage.
  • height: Specifies the height of the iframe in pixels or as a percentage.
  • frameborder: Specifies whether or not to display a border around the iframe. Set it to 0 to remove the border.
  • allowfullscreen: Specifies whether the iframe can be viewed in fullscreen mode. Use the value "true" to allow fullscreen, or "false" to disable it.
  • sandbox: Specifies a sandbox mode for the iframe, which provides a restricted environment for the embedded content. This attribute can help mitigate security risks. Possible values include "allow-same-origin", "allow-scripts", "allow-forms", and "allow-popups", among others.

Here’s an example that demonstrates the usage of some of these attributes:


This iframe embeds the webpage at “https://phpgurukul.com” with a width of 500 pixels and a height of 300 pixels. The frameborder attribute is set to 0 to remove the border, and the allowfullscreen attribute enables fullscreen mode for the embedded content.

It’s important to note that when embedding content from external sources, such as other websites, you need to ensure that you have the necessary permissions or licenses to do so. Respect the content owner’s terms and conditions.

I hope this provides a better understanding of iframes in HTML! Let me know if you have any further questions.

The post HTML – Iframes appeared first on PHPGurukul.



This post first appeared on PHP Gurukul, please read the originial post: here

Share the post

HTML – Iframes

×

Subscribe to Php Gurukul

Get updates delivered right to your inbox!

Thank you for your subscription

×