2 回答

TA贡献1811条经验 获得超5个赞
父DIV设置为相对定位,子DIV设置为绝对定位。
<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左上角为起点,如果没有就默认屏幕左上角了。
子DIV的绝对定位:是无视父DIV下别的元素。然后就是left:0; top:0; 这个是用来定位的
希望对你有帮助

TA贡献1842条经验 获得超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 关注
- 1747 浏览
添加回答
举报