disable background using css when popup appear

前端 未结 1 1195
再見小時候
再見小時候 2020-12-15 09:51

I am using the below css code to block the entire page when the popup appeared. But it\'s working(The visible page only covered not all). I have a problem, if my page having

相关标签:
1条回答
  • 2020-12-15 10:23

    use this css

    .parentDisable{
        position: fixed;
        top: 0;
        left: 0;
        background: #000;
        opacity: 0.8;
        z-index: 998;
        height: 100%;
        width: 100%;}
    
    #popup{
        position: absolute;
        z-index: 999;}
    

    and this html

    <div class="parentDisable"></div>
    <div id="popup">My pop up</div>
    
    0 讨论(0)
提交回复
热议问题