控制层的想对位置

作者在 2006-10-21 18:33:00 发布以下内容
 

<style type="text/css">
<!--
.pos {
position: relative;
}
-->
</style>

 

                   <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td height="290" valign="top" class="pos"><div id=''layer1'' style=''position:absolute; left:100px; top:100px; width:170px; height:84px; z-index:1;visibility:hidden''></div>
                 </td>
                            </tr>
                          </table>

 

把<div id="Layer1" style="position:absolute; width:130px; height:388px; z-index:1; left: 137px; top: 128px; overflow: auto">
替换为:<div id="Layer1" style="position:relative; width:130px; height:388px; z-index:1; left: 37px; top: 28px; overflow: auto">
起决定性作用的是红色部分。absolute说明层的坐标是相对于浏览器的,relative说明它的坐标是相对于层所在的表格的。

电脑技术_摘录 | 阅读 1845 次
文章评论,共0条
游客请输入验证码