twitter-bootstrap Bootstrap 模态窗口是灰色的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18580203/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:12:55  来源:igfitidea点击:

Bootstrap modal window is grayed out

twitter-bootstrap

提问by Don P

Go to this site, click "Log In" in the top right corner, and a twitter-bootstrap modal window will pop out but be grayed out.

转到此站点,单击右上角的“登录”,将弹出 twitter-bootstrap 模式窗口,但显示为灰色。

Why does this happen?

为什么会发生这种情况?

回答by adrift

It's because .navbar-fixed-tophas a z-index of 1030 while the modal backdrop has a z-index of 1040, causing the modal to overlay the navbar.

这是因为.navbar-fixed-topz-index 为 1030,而模态背景的 z-index 为 1040,导致模态覆盖导航栏。

To fix this, just adjust the .modal-backdropz-index value to be lower than 1030 - e.g.

要解决此问题,只需将.modal-backdropz-index 值调整为低于 1030 - 例如

.modal-backdrop {
    z-index: 1020;
}

回答by Jossi Fresco

You can also use:

您还可以使用:

 .modal-backdrop.in { z-index: auto;}

回答by Hany Gamil

First of all, add data-backdrop="false"to your modal div

首先,将data-backdrop="false" 添加到您的模态 div

Then add the following to your style:

然后将以下内容添加到您的样式中:

.modal { background: rgba(000, 000, 000, 0.8); min-height:1000000px; }

Don't forget to add the close button into your modal...

不要忘记将关闭按钮添加到您的模态中...

<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

Cheers..

干杯..

回答by Alex

I had to add !important to get it working.

我必须添加 !important 才能让它工作。

.modal-backdrop {
    z-index: 1020!important;
}