【发布时间】:2018-09-24 02:12:39
【问题描述】:
我正在尝试使用 flexbox 并排嵌入两个视频(一个来自 youtube,一个来自 facebook),但我需要让它们具有响应性。我浏览了网站上的其他问题,它们很有帮助,但我仍然遇到左侧视频显示 2 倍于右侧视频高度的问题。任何人都可以看看,让我知道我做错了什么?提前致谢。
<div class="video">
<div class="video-header">
<h1>VIDEO</h1>
</div>
<div class="youtube-top">
<div class="video-responsive1">
<iframe width="650" height="350" src="https://www.youtube.com/embed/gghVoRX-sn0?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div class="video-responsive2">
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fdjtrentino%2Fvideos%2F10153921589011137%2F&show_text=0&width=560" width="650" height="350" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>
</div>
</div>
</div>
.youtube-top {
display: flex;
justify-content: center;
align-items: center;
}
.video-responsive1{
overflow: hidden;
position: relative;
padding-bottom: 56.25%;
height: 0;
}
.video-responsive1 iframe{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-responsive2{
overflow: hidden;
position: relative;
padding-bottom: 56.25%;
height: 0;
}
.video-responsive2 iframe{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-responsive1,
.video-responsive2{
flex: 1;
}
【问题讨论】:
标签: html css responsive-design youtube flexbox