Youtube嵌入代码无法正常工作,如何修复此问题?
答案 0 :(得分:0)
事实证明您使用 错误的 src
作为<iframe>
。你应该使用
https://www.youtube.com/embed/Foayrk4V5b4?&autoplay=1
而不是
http://www.youtube.com/embed/Foayrk4V5b4?&autoplay=1
问题https://
。
/* --- RESPONSIVE VIDEO --- */
.embed-container {
position: relative;
padding-bottom: 56.25%;
/* 16/9 ratio */
padding-top: 30px;
/* IE6 workaround*/
height: 0;
overflow: hidden;
}
.embed-container iframe,
.embed-container object,
.embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
}
/* --- This isn't needed, but helps demonstrate the "responsiveness" --- */
.wrapper {
width: 90%;
margin: 0 auto;
}
<div class="wrapper">
<h1>Scale Me - Responsive Video</h1>
<div class="embed-container">
<iframe allowfullscreen="" frameborder="0" scrolling="no" src="https://www.youtube.com/embed/Foayrk4V5b4?&autoplay=1"></iframe>
</div>
</div>