<div class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如何更改bootstrap中的默认模态位置,我应该在哪里编辑以更改默认位置.
Bootstrap 4中的垂直中心模态对话框.
注意:添加了以下要求以明确我正在寻找一种适当的方法来垂直居中Bootstrap模式,涵盖所有可能的设备,在所有浏览器中.在我的情况下,我想要一个大型SPA在整个应用程序中重用相同的模式,所以我需要它在每种情况下工作.
这应该:
1%display:table-cell或类似的黑客(任何布局技术不意味着或设计用于布局)click或tap在其外的任何地方.modal-content(包括上方和下方).modal-dialog vertical-alignment flexbox bootstrap-modal bootstrap-4
我在我的网站上添加了 Bootstrap 模态,但我注意到模态和屏幕顶部之间的空间大于模态和屏幕底部之间的空间。
我已经添加style="margin-top:0;padding-top:0"到每个div标签,但没有效果。
目的是减少模态和屏幕顶部之间的间隙。