modal appear behind fixed navbar

前端 未结 5 2179
生来不讨喜
生来不讨喜 2021-02-19 03:50

so i have bootstrap based site with fixed navigation bar (that follow you around the page at the top) and when i want to show modal popup, it appear behind those navigation bar,

5条回答
  •  悲哀的现实
    2021-02-19 04:33

    You need to adjust the z-index in your CSS. The z-index for your navigation is higher number than everything else. So to adjust it you need to add a z-index that is higher for your modal popup. the code would look like

    For example z-index: 3;

    To be able to do this you have to set a position to your popup.

    For example position: absolute;

    After setting the position you can also adjust the position even more with putting this code in to your CSS

    top: 500px; left:500px;

    This means that the container you put a absolute position on is moved 500 pixels from the top and 500 pixels from the left.

    If you cannot understand what z-index is. I will provide a picture for you.

    z-index axis example

提交回复
热议问题