Implement parent div transparency and child div opacity

Source: Internet
Author: User
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "">
<Html xmlns = "">
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> css outer DIV translucent inner div Opacity-Implementation of the pop-up layer effect [Example] </title>
<Style type = "text/css">
<! --
Body, td, th {
Font-size: 12px; padding: 0; margin: 0;
. Tanchuang_wrap {width: 600px; height: 400px; position: absolute; left: 0px; top: 0px; z-index: 100; display: none ;}
. Lightbox {width: 600px; z-index: 101; height: 400px; background-color: red; filter: alpha (Opacity = 20);-moz-opacity: 0.2; opacity: 0.2; position: absolute; top: 0px; left: 0px ;}
. Tanchuang_neirong {width: pixel PX; height: 153px; border: solid 1px # f7dd8c; background-color: # FFF; position: absolute; z-index: 105; left: 123px; top: 123px ;}
<Script language = "javascript">
Function closeDiv (divId ){
Document. getElementById (divId). style. display = 'none ';
Function displayDiv (divId ){
Document. getElementById (divId). style. display = 'block ';
<Div style = "width: 400px; height: 400px; position: relative; text-align: center;">
<Div class = "tanchuang_wrap" id = "aaaa">
<Div class = "lightbox"> </div>
<Div class = "tanchuang_neirong">
<P> <span onClick = "closeDiv ('aaa')" style = "cursor: pointer;"> close </span> </p>
Here is the pop-up window content </div>
<Span onclick = "displayDiv ('aaa')" style = "cursor: pointer;"> click me </span>
<P> tested and compatible with Internet Explorer 3.6, Internet Explorer, Firefox, and other browsers </p>

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: 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.