CSS 在引导程序中将大小设置为响应式 iframe
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27384997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
set size to responsive iframe in bootstrap
提问by Dominik Stürzer
Is it possible to set a size to an inframe in bootstrap?
是否可以在引导程序中将大小设置为内框?
I set up the iframe like this:
我这样设置 iframe:
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="…"></iframe>
</div>
And I tried to set a maximum height to 450 px with this:
我尝试将最大高度设置为 450 像素:
.embed-responsive {
max-height:450px;
}
This had no effect at all. Can you give me a hint, how could achieve a smaller but still responsive iframe?
这根本没有效果。你能给我一个提示,如何实现更小但仍然响应的 iframe?
回答by Lxske
I've had the same problem and solved it by adding a row and col-sm-8 (according to what size you'd like) around the .embed-responsive div.
我遇到了同样的问题,并通过在 .embed-responsive div 周围添加一行和 col-sm-8(根据您想要的大小)来解决它。
<div class="row">
<div class="col-sm-8">
<div class="bs-example" data-example-id="responsive-embed-16by9-iframe-youtube">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="" allowfullscreen=""></iframe>
</div>
</div>
</div>
</div>