z-index between Children and Parents

后端 未结 7 1013
我在风中等你
我在风中等你 2020-12-10 18:08

I\'m having problems working out the z-index order for an application we\'re working on, i have two root parents, a nav bar and a map, and one child, the map tooltip. The na

7条回答
  •  我在风中等你
    2020-12-10 18:29

    After going through, your codes, i noticed this.

     #tooltip{
    background-color: yellow;
    width: 200px;
    height: 200px;
    color: black;
    padding: 10px;
    z-index: 15;
        }
    

    Your #tooltip has a z-index, but it's not positioned. Z-index property will only work if it's has one of the position property value. And considering you want the tooltip to stand out, you should use the absolute position value like this.

     #tooltip{
    position: absolute;
    background-color: yellow;
    width: 200px;
    height: 200px;
    color: black;
    padding: 10px;
    z-index: 15;
     }
    

    HTML

    This is the map container
    This is the Tooltip

    This keeps the #tooltip on top....

提交回复
热议问题