这个问题与此有关:-
Why does a second vertical scroll bar appear in this Bootstrap 3.0 Modal demo?
好的。我已经覆盖了 .modal
类 overflow-y
规则:-
.modal {
overflow-y: auto !important;
}
但是现在当模式打开时我看不到滚动条。没关系。这就是我所需要的。但是,它仍然会占用空间,并且每当模式打开时页面都会向左移动。
截图:-
有什么解决办法吗?
最佳答案
罪魁祸首落网。 Bootstrap 使用以下名称和规则向主体和其他区域添加一个类:-
body.modal-open, .modal-open .navbar-fixed-top, .modal-open .navbar-fixed-bottom {
margin-right:15px;
}
也重写这个类如下,就可以了。
body.modal-open, .modal-open .navbar-fixed-top, .modal-open .navbar-fixed-bottom {
margin-right:0px;
}
关于html - 在 Bootstrap 3.0 Modal 中,禁用滚动条但它仍然占用空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18944234/