How can one create an overlay in css?

前端 未结 9 2054
青春惊慌失措
青春惊慌失措 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:50

    http://jsfiddle.net/55LNG/1/

    CSS:

    #box{
        border:1px solid black;
        position:relative;
    }
    #overlay{
        position:absolute;
        top:0px;
        left:0px;
        bottom:0px;
        right:0px;
        background-color:rgba(255,255,0,0.5);
    }
    

提交回复
热议问题