问题
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 position
ed 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