把一个DIV层显示到最上面
<div style="background: url(Images/XiangKuang-1.gif) no-repeat; z-index:1; width:147px;"> <div style="padding:8px 8px 0px 7px; z-index:0; width:130px; height:150px"> <asp:Image ID="Image1" runat="server" Width="130px" Height="150px" ImageUrl="~/images/quanli3.jpg"/> </div> </div>让第一个DIV的背景显示到最上面层 以上代码怎么改?
答案:<div style="background: url(Images/XiangKuang-1.gif) no-repeat; width:147px;position:absolute;z-index:1000; "> <div>
<div style="padding:8px 8px 0px 7px; z-index:0; width:130px; height:150px"> <asp:Image ID="Image1" runat="server" Width="130px" Height="150px" ImageUrl="~/images/quanli3.jpg"/></div>
其他:升值z-Index属性 值越大 就在最上面显示了 百度下 z-index用法
问题基本上可以搞定了 <div style="background: url(Images/XiangKuang-1.gif) no-repeat; z-index:1; position:absolute;width:147px;">
<div style="padding:8px 8px 0px 7px; z-index:0; width:130px; height:150px;position:absolute;"> <asp:Image ID="Image1" runat="server" Width="130px" Height="150px" ImageUrl="~/images/quanli3.jpg"/>
</div> </div>
关键要设置绝对定位,才能应用z-index
上一个:求Jquery 拖动div 层 代码
下一个:在div中 style="margin-right 是什么属性?