HTML YouTube Video Tag
- The easiest way to play videos in HTML is to use YouTube.
- You can embed a YouTube video on your web page using the
<iframe>
tag.
<iframe>
tag.Here is an example of how to embed a YouTube video in HTML:
<iframe width="560" height="315" src="https://www.youtube.com/embed/olVFZnFib2I?si=h-HVtVzysK7WBtT1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
width
and height
attributes specify the size of the video player in pixels.src
attribute specifies the URL of the YouTube video.allowfullscreen
attribute allows the video player to be viewed in full-screen mode.CSS can be used to style the <iframe>
tag and its contents. Here is an example of how to style a YouTube video using CSS: