Matte effect
<!DOCTYPE HTML> <HTML><Head><title>DIV CSS Mask Layer</title><Scriptlanguage= "JavaScript"type= "Text/javascript">functionShowdiv () {document.getElementById ("BG"). Style.display="Block"; document.getElementById ("Show"). Style.display="Block"; }functionHidediv () {document.getElementById ("BG"). Style.display='None'; document.getElementById ("Show"). Style.display='None'; }</Script><styletype= "Text/css">#bg{Display:None;position:Absolute;Top:0%; Left:0%;width:100%;Height:100%;Background-color:Black;Z-index:1001;-moz-opacity:0.7;Opacity:.;Filter:Alpha (opacity=70);}#show{Display:None;position:Absolute;Top:25%; Left:22%;width:53%;Height:49%;padding:8px;Border:8px Solid #E8E9F7;Background-color: White;Z-index:1002;Overflow:Auto;}</style></Head><Body><inputID= "Btnshow"type= "button"value= "Show"onclick= "Showdiv ();"/><DivID= "BG"></Div> <!--mask layer --<DivID= "Show">Test<inputID= "Btnclose"type= "button"value= "Close"onclick= "Hidediv ();"/></Div></Body></HTML>
Copy the above code to the HTML page to see the effect.
The principle is relatively simple, that is, in the page first define the need to display the div and mask layer of CSS, and then used in the OnClick event, through the JS to control the style of two div: display= ' block ' or display= ' none '. You can realize the display and hiding of Div.
Note the z-index of the two Div, the z-index of the topmost div must be larger than the z-index of the mask layer.
[Turn] http://www.cnblogs.com/aspx-net/archive/2011/03/11/1981071.html
ps:http://www.ituring.com.cn/article/68352 masking issues that may be encountered
HTML Matte Effect