HTML Matte Effect

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.