<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<Style>
Body {Background: URL (http://www.google.com.hk/intl/zh-CN/images/logo_cn.png) 0 0 repeat ;}
* {Margin: 0; padding: 0 ;}
. Boxer {width: 600px; Height: 400px; overflow: hidden; margin: 0 auto; Border: 6px solid red ;}
. Opacity {
Height: 400px;
Background-color: rgba (0.5, 0,);/* The standard browser only needs this sentence */
Background-color: #000 \ 9;/* ie series */
Filter: alpha (opacity = 50);/* ie series */
/*
As a transparent background layer, you cannot have the position attribute. I don't know why...
.
Background-color: rgba (0.5, 0,). IE6 seems to be able to read a small part. Therefore, you can only write background-color: #000 after it, and then add a private hack of IE.
If you don't believe it, try it.
Background-color: #000; Background-color: rgba (0,0, 0, 0.5); filter: alpha (opacity = 50 );
IE6 will hurt you!
*/
}
. Boxerinner {position: relative;/* ie series */
Text-align: center; font-size: 24px; font-weight: 700; color: yellow ;}
</Style>
</Head>
<Body>
<P style = "font-size: 60px; color: #000; text-align: center; padding: 20px; font-weight: 700;"> CSS: transparent background color, the ultimate method of content opacity! Compatibility, ultimate. </P>
<Div class = "Boxer">
<Div class = "opacity">
<Div class = "boxerinner"> boxerinner </div>
</Div>
</Div>
</Body>
</Html>