HTML · HTML Media · Lesson 49
HTML YouTube
Embed YouTube videos with an iframe.
The easiest way to play videos is to upload them to YouTube and embed them with an <iframe>.
- Upload the video to YouTube and note its video id
- Define an
<iframe>withsrcpointing tohttps://www.youtube.com/embed/VIDEO_ID - Use
widthandheightto set the size
Example
<iframe width="420" height="236" src="https://www.youtube.com/embed/tgbNymZ7vqY" title="YouTube video" allowfullscreen></iframe>
Options
Keep reading “HTML YouTube”
Sign up to read the full lesson (1 more parts), try every example in the live editor, and take the 5-question quiz.