Ole*_*yan 41 bootstrap-modal bootstrap-4
我希望模态为屏幕宽度的80%左右.modal-lg不够大.这个:
.modal .modal-dialog {
width: 80%;
}
Run Code Online (Sandbox Code Playgroud)
不适用于Bootstrap 4.
cla*_*ios 77
您可以modal-lg通过以下操作创建或仅覆盖默认引导程序:
.modal-lg {
max-width: 80%;
}
Run Code Online (Sandbox Code Playgroud)
如果不工作只是添加!important所以它看起来像下面
.modal-lg {
max-width: 80% !important;
}
Run Code Online (Sandbox Code Playgroud)
现在打电话给modal-lg.
<div class="modal-dialog modal-lg" role="document">
<!-- some modal content --->
</div
Run Code Online (Sandbox Code Playgroud)
Joe*_* Jr 10
对于回应答案.
@media (min-width: 992px) {
.modal-dialog {
max-width: 80%;
}
}
Run Code Online (Sandbox Code Playgroud)
小智 8
在 Bootstrap 4 中,您必须使用 'max-width' 属性,然后它才能完美运行。
<div id="modal_dialog" class="modal fade" tabindex="-1" role="dialog" style="display: none;">
<div class="modal-dialog" style="max-width: 1350px!important;" role="document">
<div class="modal-content">
<div class="modal-body">
Sample text
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)