在 HTML 网页上添加 YouTube 视频
可以轻松地将视频从 YouTube 添加到您的网页。您只需要嵌入视频即可。
首先,获取视频编号 −
步骤 1:转到视频并右键单击。选择“关于此视频” −

单击后,您将看到以下对话框,显示统计信息 −

上面您可以看到视频编号为 F6m0ghjadlw。现在,我们将使用其编号嵌入同一个视频 −
示例
<!DOCTYPE html> <html> <head> <title>Learn WordPress</title> </head> <body> <h1>WordPress Installation</h1> <p>Following is the video demonstrating how to install WordPress on localhost using XAMPP Server:</p> <iframe height="350" width="600" src="https://www.youtube.com/embed/F6m0ghjadlw"> </iframe> </body> </html>
输出
以下是成功在网页上嵌入 YouTube 视频的输出显示 −

您还可以使用 <embed> 标记实现相同功能。以下是 HTML 代码 −
示例
<!DOCTYPE html> <html> <head> <title>Learn WordPress</title> </head> <body> <h1>WordPress Installation</h1> <p>Following is the video demonstrating how to install WordPress on localhost using XAMPP Server (video uploaded using embed element):</p> <embed height="350" width="600" src="https://www.youtube.com/embed/F6m0ghjadlw"> </body> </html>
输出
输出显示视频已成功嵌入 −

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP