how to use z-index with relative positioning?

后端 未结 4 1480
感动是毒
感动是毒 2020-12-03 09:57

I have a problem with z-index and my code. I want to have a popup on every row, positioned relative to that row. So I created this code:

4条回答
  •  青春惊慌失措
    2020-12-03 10:28

    You can use z-index with the relative position. You just need to specify position: relative. If you really want it to look like it is popping up, I suggest using box-shadow

    .popup {
        position:relative;
        left: 0px;
        top: 10px;
        width: 100px;
        height: 100px;
        background:yellow;
        z-index: 4;
    
        -webkit-box-shadow: 0px 6px 6px 0px rgba(213,213,213,0.6);
        -moz-box-shadow: 0px 6px 6px 0px rgba(213,213,213,0.6);
        -ms-box-shadow: 0px 6px 6px 0px rgba(213,213,213,0.6);
        -o-box-shadow: 0px 6px 6px 0px rgba(213,213,213,0.6);
        box-shadow: 0px 6px 6px 0px rgba(213,213,213,0.6);
    }
    

提交回复
热议问题