z-index between Children and Parents

后端 未结 7 1016
我在风中等你
我在风中等你 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条回答
  •  猫巷女王i
    2020-12-10 18:25

    Below solution should work but I don't know if you have a requirement like keeping nav-bar outside map-container. If so I don't think that there is a workaround for that.

    CSS:

    #tooltip-helper{
        position:relative;
        /*below properties are to demonstrate the helper*/
        width:10px;
        height:10px;
        background-color:green;
        top:200px;
        left:200px;
    }
    
    #tooltip
    {
        position:absolute;
        top:10px;/*this is just to make sure helper is visible*/
        left:-100px;/*this is to center the tooltip*/
        width: 200px;
        height: 200px;
        background-color: yellow;
        color: black;
        padding: 10px;
        z-index: 15;
    }
    

    HTML:

    This is the map container
    This is the Tooltip

提交回复
热议问题