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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This question already has answers here:
Closed last month.
回答1:
You can add a transparent overlay over your content, like so:
http://jsfiddle.net/andresilich/WHEK3/1/
回答2:
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
回答3:
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;
}
回答4:
Use z-index
for both div DIV
http://www.w3schools.com/cssref/pr_pos_z-index.asp
use
opacity:0.5
for the DIV 1. unfortunately all IE couldn't support opacity
回答5:
I need it like you, but I use this code:
<div class="content"><object type="application/x-shockwave-flash" height="100" width="222" data="http://www.usflashmap.com/component/cdt_new/cdt2_1.swf">
<param name="movie" value="http://www.usflashmap.com/component/cdt_new/cdt2_1.swf" />
<param name="base" value="http://www.usflashmap.com/component/cdt_new/" />
<param name="flashvars" value="
&timer=1&
&time_template=2:ss;1:mm;0:hh&
&time_color=0x000000&
&label_color=0x000000&
&background_color=0xFFFFFF&
&flare_view=true&
&time_label=d:DAY;h:HOUR;m:MIN;s:SEC&
&time_zone=Local time&
&event_time=year:2014;month:1;day:1;hour:0;minute:0;seconds:0&
&event_duration=year:0;month:0;day:0;hour:0;minute:0;seconds:0&
&event_recursion=yearly&
&onpress_url=-&
&event_onpress_url=-&
&title=Nový rok je za:&
&event_title=event&
&sound_file=-&
&event_sound_file=-&
&transparent=true&
" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
</object><div class="overlay"></div></div>