Twitter bootstrap iframe与引导的响应问题

Twitter bootstrap iframe与引导的响应问题,twitter-bootstrap,iframe,twitter-bootstrap-3,Twitter Bootstrap,Iframe,Twitter Bootstrap 3,我正在使用带引导的iframe,它在中没有响应。在您提供的代码中,您正在为的高度和宽度指定绝对值。如果没有任何其他媒体查询来修改这些值,您将不会有任何响应 如果您使用的是Bootstrap4,那么就可以使用embed responsive类,该类专门解决了您的问题。对于Bootstrap 3,您可能希望创建自己的类: .responsive-iframe { width: 100%; height: 100%; min-height: 75vh; // Change this bas

我正在使用带引导的
iframe
,它在中没有响应。在您提供的代码中,您正在为
高度和
宽度指定绝对值。如果没有任何其他媒体查询来修改这些值,您将不会有任何响应

如果您使用的是Bootstrap4,那么就可以使用
embed responsive
类,该类专门解决了您的问题。对于Bootstrap 3,您可能希望创建自己的类:

.responsive-iframe {
  width: 100%;
  height: 100%;
  min-height: 75vh; // Change this based on your own preferences
}
.responsive {
  width: 100%;
  height: 100%;
  min-height: 300px;
  overflow-y: hidden;
  overflow-x: visible;
}
然后将其应用于您的

此时,嵌入将占其父容器宽度的100%,最小高度为视口高度的75%。我要指出的是,这个“75vh”只是为了允许演示的最小显示。您可能需要针对您的特定项目调整此设置

如果您正在考虑过渡到Bootstrap 4,您可以在此处阅读有关其嵌入类的更多信息:


您的iframe上没有任何响应样式。您当前正在指定静态高度和宽度样式。查看Bootstrap 4的文档,它有一个内置的iFrame响应类,类似于:

<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
    <iframe class="embed-responsive-item" src="..."></iframe>
</div>
如果在iFrAME中的内容不能准确地显示在您所给的空间中,请考虑将样式指定为“溢出-y:隐藏;溢出- x:可见”。
.responsive {
  width: 100%;
  height: 100%;
  min-height: 300px;
  overflow-y: hidden;
  overflow-x: visible;
}