IE CSS半透明的注意事項
在IE下的半透明層,必須在樣式里明確定義寬度或高度,才能出現半透明效果,否則無法半透明 , 如下
復制代碼代碼如下:
style type="text/css"!--
.tm {
filter:alpha(opacity=50);
opacity: 0.5;
-moz-opacity:0.5;
background-color:#000000;
width:100%;
color:#ffffff;
}
.tp {
background-color:#ff00ff;
vertical-align: bottom;
height: 226px;
width: 140px;
}
--/style
style type="text/css" mce_bogus="1".tm {
filter:alpha(opacity=50);
opacity: 0.5;
-moz-opacity:0.5;
background-color:#000000;
width:100%;
color:#ffffff;
}
.tp {
background-color:#ff00ff;
vertical-align: bottom;
height: 226px;
width: 140px;
}/style
table border="0" cellspacing="0" cellpadding="0" class="tp"
tr
td valign="bottom"
div class="tm"
asfasdfasd
/div
/td
/tr
/table
這個半透明是正常的,如果把樣式tm的width:去掉,在firefox里依然正常透明,到了IE里就不能透明了!
