How can one create an overlay in css?

前端 未结 9 2051
青春惊慌失措
青春惊慌失措 2020-11-29 17:58

I\'d like to create a div with an arbitrary size, then display something on top of that div. What is the best way to position and size the overlay exactly as the div below i

9条回答
  •  天命终不由人
    2020-11-29 18:45

    Quick answer without seeing examples of your current HTML and CSS is to use z-index

    css:

    #div1 {
    position: relative;
    z-index: 1;
    }
    
    #div2 {
    position: relative;
    z-index: 2;
    }
    

    Where div2 is the overlay

提交回复
热议问题