Hello, young web designer! In this tutorial, we're going to learn about inserting YouTube videos into your HTML web pages. Adding YouTube videos can make your site more engaging and allows you to share content from other creators. Let's get started!
Find the YouTube Video First, find the YouTube video you want to embed on your web page. Visit the YouTube website, search for the video, and click on it to open the video page.
Get the Embed Code To get the embed code for the YouTube video, follow these steps:
Step 1: Under the video, click on the "Share" button.
Step 2: In the popup window, click on the "Embed" option.
Step 3: You will see a box containing the embed code. It starts with <iframe...
. Click the "Copy" button or manually select the code and press Ctrl+C (or Command+C on a Mac) to copy the code.
html<!DOCTYPE html>
<html>
<head>
<title>My Favorite YouTube Video</title>
</head>
<body>
<h1>Check Out This Cool Video!</h1>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ExampleVideoID" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</body>
</html>
Make sure to replace the ExampleVideoID
with the actual video ID from the embed code you copied.
Adding YouTube videos to your HTML web pages is a great way to share content and enhance your site. Keep practicing, and soon you'll be able to incorporate YouTube videos into your web designs like a pro!