我尝试使用下面提到的代码在我的网页中添加YouTube视频,是 有谁可以帮助我。看看下面的代码。
<div style="width:400px; height:200px;">
<embed src="https://www.youtube.com/watch?v=Q-AV9KMLTFc" wmode="transparent"
type="application/x-shockwave-flash" width="100%" height="100%"
allowfullscreen="true" title="Adobe Flash Player">
</div>
答案 0 :(得分:0)
点击分享&gt;后,使用Youtube为您生成的代码。嵌入。它看起来像这样:
<iframe width="560" height="315" src="https://www.youtube.com/embed/Q-AV9KMLTFc" frameborder="0" allowfullscreen></iframe>
将宽度和高度设置为您喜欢的任何值。
答案 1 :(得分:0)
您可以使用<iframe>
这样做:
<iframe width="500" height="500"
src="https://www.youtube.com/embed/vEROU2XtPR8">
</iframe>
使用自动播放:
<iframe width="500" height="500"
src="https://www.youtube.com/embed/vEROU2XtPR8?autoplay=1">
</iframe>
注意:&#34;嵌入/&#34;在src中,请务必写出正确的YouTube视频ID,该ID可在&#34; =&#34;之后的URL链接中找到。符号
例如:在此链接中,https://www.youtube.com/watch?v=vEROU2XtPR8 Youtube视频ID =&#34; vEROU2XtPR8&#34;。
请务必提供应在屏幕上显示的视频大小的宽度和高度属性。