我有数据库内容,其中有不同类型的数据,如Youtube视频,Vimeo视频,文本,Imgur图片等。所有这些都有不同的高度和宽度。当我在互联网上搜索的时候,我发现只有一个参数的大小改变了。它必须与弹出窗口中的内容相同。
这是我的HTML代码。我还使用Ajax来调用内容。
<div id="modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="ModalLabel"></h3>
</div>
<div class="modal-body">
</div>
</div>
发布于 2016-01-28 16:52:24
这对我来说很管用,上面的这些都不管用。
.modal-dialog{
position: relative;
display: table; /* This is important */
overflow-y: auto;
overflow-x: auto;
width: auto;
min-width: 300px;
}
发布于 2015-06-18 20:44:52
我不能让PSL的答案为我工作,所以我发现我所要做的就是用style="display: table;"
设置包含模式内容的div。模态内容本身说明了它想要的大小,并且模态容纳了它。
发布于 2017-02-22 19:49:20
如果你想编写css,有很多方法可以做到这一点,然后添加以下内容
.modal-dialog{
display: table
}
以防您想要添加内联
<div class="modal-dialog" style="display:table;">
//enter code here
</div>
不要将display:table;
添加到modal-content类中。它完成了你的工作,但配置你的大尺寸的模式,见下面的截图。第一张图片是如果你添加样式到模式对话框中
如果您将样式添加到modal-content。它看起来像是错位的。
https://stackoverflow.com/questions/16152275
复制相似问题