未在 Bootstrap 中设置 z-index [英] z-index not setting in Bootstrap

查看:38
本文介绍了未在 Bootstrap 中设置 z-index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用引导程序,我有一个弹出的模态,它工作得很好,只有 .modal-dialog 的 z-index 为 0,即使它确实被设置了..modal-backdrop.nz-index 为 1030,效果很好,所以 .modal-dialog 被放入/在黑色背景下.

I am using bootstrap and I have a modal that pops up and it works just fine only the .modal-dialog has a z-index of 0 even though it DOES get set. The .modal-backdrop.n has a z-index of 1030 and that works just fine so the .modal-dialog is being put in/under the black back drop.

有人知道这里发生了什么以及如何解决吗?

Anyone know what the heck is going on here and how to fix?

非常感谢!

我很清楚这样的事情 z-index 父子关系

简单的 Bootstrap Modal Fiddle

Simple Bootstrap Modal Fiddle

编辑

我将引导程序版本从 v3.0.0 --> v3.3.2 升级,现在一切正常.只是为了显示与最新版本保持同步.感谢大家的帮助!

I upgraded my bootstrap version from v3.0.0 --> v3.3.2 and now everything is working fine. Just goes to show stay up to date with the latest versions. Thanks for all help everyone!

推荐答案

z-index 仅适用于 position ed 元素.所以设置position:relative;position:absolute;position:fixed;.

The z-index only works on positioned elements. So set position: relative;, position: absolute;, or position: fixed;.

  • 如果可能,请不要使用!important

答案来源来自 sandeep.

Answer Source from sandeep.

这篇关于未在 Bootstrap 中设置 z-index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆