To embed a YouTube video in an HTML document, you can use an <iframe> element with the appropriate src attribute pointing to the YouTube video's embed URL.
Here's an example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Embedding YouTube Video</title>
</head>
<body>
<h2>YouTube Video Example</h2>
<iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID" frameborder="0" allowfullscreen></iframe>
</body>
</html>
Replace "VIDEO_ID" in the src attribute with the actual ID of the YouTube video you want to embed. You can find the video ID in the YouTube video URL after the "v=".
For example, if the YouTube video URL is https://www.youtube.com/watch?v=abcdef12345, then the video ID is "abcdef12345".
<iframe width="560" height="315" src="https://www.youtube.com/embed/abcdef12345" frameborder="0" allowfullscreen></iframe>
Adjust the width and height attributes of the <iframe> to set the dimensions of the embedded video player according to your design.
Please note that embedding YouTube videos using an <iframe> is the recommended way, as it provides a responsive and consistent player across different devices and browsers.