HTML Showing a YouTube Video

H
andrewgbliss
a month ago

This article will cover how to add a YouTube video to your HTML webpage

. . .

Github repo

https://github.com/EntryLevelDeveloperTraining/html-workshop

The iframe tag

What is the iframe tag? It is an inline frame element that has the ability of showing outside content right inside of your own webpage. You can show a whole other website, or video.

This lesson will focus on showing a YouTube video right in your HTML.

HTML

<!DOCTYPE html>
<html>

<head>
  <title>IFrame</title>
</head>

<body>
  <h1>IFrame</h1>
  <iframe width="560" height="315" src="https://www.youtube.com/embed/cYuvs9kEh9I" title="YouTube video player"
    frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
    allowfullscreen></iframe>
</body>

</html>

Conclusion

iframes are a good way to embed outside documents, webpages, videos in your webpage. Be careful though as to not bring in any unwanted content.


H
andrewgbliss
a month ago