z-index not setting in Bootstrap

倖福魔咒の 提交于 2019-12-13 18:18:36

问题


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?

Greatly appreciated!

I am well aware of stuff like this z-index parent/child relationship

Simple Bootstrap Modal Fiddle

EDIT

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!


回答1:


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


  • Please never use !important if possible!

Answer Source from sandeep.



来源:https://stackoverflow.com/questions/29038860/z-index-not-setting-in-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!