How to put a static div on top of an absolute position div?

前端 未结 6 1844
误落风尘
误落风尘 2020-12-29 18:49

I am building a small web application. I have two divs. One is absolute and the other is static. I am trying to position my static div on top of my absolute one, so that it

6条回答
  •  半阙折子戏
    2020-12-29 19:29

    You could have a second absolutely positioned div to contain your statically positioned elements:

    I want this to appear under my static items.
    blah
    yada
    foo
    bar

    And your css is

    .underlay {
       position: absolute;
       z-index: 0;
    }
    
    .item_container {
       position:absolute;
       z-index:10;
       top: 0;
       left: 0;
       height: 100%;
       width: 100%;
    }
    
    .item {
       position: static;
    }
    

提交回复
热议问题