gpt4 book ai didi

css - Youtube iframe 响应并向左浮动

转载 作者:行者123 更新时间:2023-11-28 12:10:00 25 4
gpt4 key购买 nike

我需要使 youtube iframe 响应,并且 iframe 保持 float 以向右侧添加内容,我尝试使用此代码但 iframe 没有响应?

谢谢。

JSFiddle:http://jsfiddle.net/94150148/vh04d7y2/

.videoWrapper {
position: relative;
padding-bottom: 51.44%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.box1 {
float:left;
width: 400px
}
<div class="box1">
<div class="videoWrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/6apL89xgbR0"
frameborder="0" allowfullscreen></iframe></div></div>
<div class="box2">Some text</div>

最佳答案

我会建议使用 Bootstrap为了使通过 iframe 添加的嵌入式视频响应,以下是可用于使 iframe 响应的代码

<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>

<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>

但请确保添加 bootstrap.css 和其他引导依赖项。

关于css - Youtube iframe 响应并向左浮动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33131311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com