How to use iframes in HTML

The most basic usage of iframes is to embed another web page within your current HTML page.

      <iframe src="https://www.example.com/" width="100%" height="500"></iframe>

The above code will display the webpage at https://www.example.com within your current HTML page.

You can also use iframes to display videos from external sources:

      <iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ" width="100%" height="500"></iframe>

The above code will display the video at the given YouTube URL within your current HTML page.

Additionally, you can use iframes to display content from your own website:

      <iframe src="https://www.yourdomain.com/your-page.html" width="100%" height="500"></iframe>

The above code will display the HTML content on your page located at http://www.yourdomain.com/your-page.html within your current HTML page.

 

  Written by: Steven Iversen     30-05-2023     Written in: HTML tutorials

2 Comments

  • Kai says:

    Thanks for this tutorial! I found it really helpfull and now I understand how to use iframes properly . This can realy enhance the user expeariance on my website. Keep up the good work!

  • Fernando says:

    Wow, I never knew using iframes in HTML could be so easy! This tutorial really made it clear for me . I used to struggle with embedding content from other websites, but now I can confidently do it with iframes. Thank you so much for sharing this useful guide! Can’t wait to implement iframes in my future projects.

Leave a Reply

Your email address will not be published. Required fields are marked *