2 回答

TA貢獻(xiàn)1811條經(jīng)驗 獲得超5個贊
父DIV設(shè)置為相對定位,子DIV設(shè)置為絕對定位。
<div style="height:158px; width:158px; position:relative;">
Test001
<div style="height:158px; width:158px; filter: alpha(opacity=45); opacity:0.45; position:absolute; left:0; top:0;">
Test002<br/>
</div>
</div>
父級的相對定位:是要把子DIV的絕對定位的起點以父DIV左上角為起點,如果沒有就默認(rèn)屏幕左上角了。
子DIV的絕對定位:是無視父DIV下別的元素。然后就是left:0; top:0; 這個是用來定位的
希望對你有幫助

TA貢獻(xiàn)1842條經(jīng)驗 獲得超13個贊
你這樣寫試一下:
<div style="height:158px; width:158px; position:relative; background:#FF0000;">
Test001
<div style="height:158px; width:158px; position: absolute; top:0px; background:#000000;
filter: alpha(opacity=45); opacity:0.45;">
Test002<br/>
</div>
</div>
- 2 回答
- 0 關(guān)注
- 1736 瀏覽
添加回答
舉報