在嵌入的代码周围添加一个 div 标签。 使用 CSS 类 video-responsive 使您的代码现在看起来像这样:
<div class="video-responsive"> <iframe width="420" height="315" src="/" frameborder="0" allowfullscreen></iframe> </div>
然后在您的样式表文件之一中添加一些 CSS 属性:
.video-responsive{ overflow:hidden; padding-bottom:56.25%; position:relative; height:0; } .video-responsive iframe{ left:0; top:0; height:100%; width:100%; position:absolute; }