【发布时间】:2016-07-23 09:24:02
【问题描述】:
谁能帮帮我:
我试图制作一个 100% 宽度和响应式的嵌入 youtube 视频, 我在这个网站上找到了这段代码来尝试完成这个:
http://avexdesigns.com/responsive-youtube-embed/
css:
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
HTML:
<div class="video-container">
<iframe src="http://www.youtube.com/embed/dFVxGRekRSg" frameborder="0" width="560" height="315"></iframe>
</div>
使用原样的代码:视频甚至没有出现: 所以我将溢出隐藏在代码中并将“padding-top”更改为“top”:将视频向下推:视频在我的页面顶部,它应该在上面写着“为什么 kevin Kurbs 室内设计”的下方/看下面的视频?”
为了部分获得我希望它显示的视频,我从我的 html 中删除并相应地调整 iframe:
iframe {
width: 100%;
top: 5px;
margin-bottom: -5px
}
视频代码为288-304
http://graph-art.matc.edu/harrisd5/vicom126/a2/index.html
这样做只是让 youtube 缩略图封面照片在播放视频时做出响应,它是中心。那么我如何制作这个视频 100% 宽度和响应,同时保持其纵横比放置在“为什么是 Kevin Kurbs 内部栏?”下方。 ?
【问题讨论】: