YouTube video link on HTML page.
➔ <iframe> tag is used to play YouTube video on the page.
➔ Attribute <src> is set by video URL, and <width>, <height> sets the video player dimension.
➔ Other parameters can be added URL to add more properties.
HTML iframe tag example
The HTML iframe tag is used as a container to integrate external content such as audio, video, images, pdf files etc.
Note: Click play button to play the video.
Learning with HTML Editor "Try it Now"
You can edit the HTML code and view the result using online editor.
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML iframe tag example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.mydiv {
border: 1px solid #d1d1d1;
background: #d5d5d515;
padding: 10px;
margin: 20px 0px;
}
</style>
</head>
<body>
<div class="mydiv">
<h3>HTML iframe tag example</h3>
<p>It is possible to embed any media source, such as a YouTube video link, using the iframe tag.</p>
</div>
<h4>Youtube link in iframe</h4>
<div>
<iframe class="d1" src="resources/media/seaside.mp4" allowfullscreen></iframe>
</div>
</body>
</html>
Click on the "See output" button to see how it works.