How to put a Div on another Div with transparent background?

I want to put a div(1) with transparent background on the top of another Div(2). Because I want to make all the element that div(2) contains disable. so, If i will put div(1) on top of div(2) then elements that are inside the div(2) will not be clicker anymore.


You can add a transparent overlay over your content, like so:

http://jsfiddle.net/andresilich/WHEK3/1/


make use of Z-index property thats it.

//inner div 
    .div1
    {
     z-index : 1;
    }

//outer div

    .div2
    {
     z-index : 10;
    }

div2 over lay div1.

Also check existing question answer : How to overlay one div over another div


Pranay is correct. I personally use this technique for overlays; for example:

#overlay {
 position: fixed;
 left: 0;
 right: 0;
 top: 0;
 bottom: 0;
 background-color: #333333;
 //Cross-browser opacity below
 -moz-opacity:.80;
 filter:alpha(opacity=80);
 opacity:.80;
 z-index: 10000000;
}
链接地址: http://www.djcxy.com/p/75854.html

上一篇: jQuery的CSS覆盖另一个div div?

下一篇: 如何将透明背景的Div放在另一个Div上?