透明なボックス内に不透明なテキストを入れたいです。コードサンプルは次のとおりです。
HTML:
<div id="Transparent_Box">
<div class="text">
<h1>Some opaque text</h1>
</div>
</div>
CSS:
#Transparent_box {
url(../images/header-bg.png);
background:url(../images/header-bg.png) repeat-x\0/;
background-position:center bottom, left top;
background-repeat:repeat-x;
overflow:hidden;
background-color:#FFF;
opacity: 0.6;
filter: alpha(opacity=60);
}
.text {
float:left;
margin-top:30px;
width:490px;
margin-left:20px;
opacity: 1;
filter: alpha(opacity=100);
}
.text h1 {
font-weight:900;
color:#FFF;
line-height:34px;
margin-top:8px;
opacity: 1;
filter: alpha(opacity=100);
}
継承のため、テキストは常に半透明で表示されます。透明なボックスの上に素敵な不透明なテキストを表示する方法はありませんか?
まさにそれでした...透明な.pngの背景も追加しました。次のようになります。
background-image:url(../images/header-shadow.png), url(../images/header-bg.png);
background:url(../images/header-bg.png) repeat-x\0/;
background-position:center bottom, left top;
background-repeat:repeat-x;
background-color: rgba(0,0,0,0)
これは IE8 以下で動作するはずです。