层定位
- 作者:zhaozj
- 发表时间:2020-12-23 10:57
- 来源:未知
<html><head> <meta http-equiv=Content-Type content=text/html;charset=gb2312> <title></title> </head> <table width="100" border="0" align="center"> <tr> <td>aaaaaaa</td> </tr> <tr> <td> <div id="Layer1" style="position:absolute; width:236px; height:166px; z-index:1; background-color: #6666FF; layer-background-color: #6666FF; border: 1px none #000000;"></div></td> </tr> </table> </body></html>
只要将<div></div>的代码放入<table></table>中,然后去掉style="position:absolute; 中的position:absolute; 即可让<div>给我老老实实的呆着拉,最好后面加上overflow: scroll;防止溢出,要不会很难看的哦
<div id="ta" style="position: relative; width:87px; height:300px; z-index:2; left: 30%; top: 35%;">这就是一个相对定位,绝对定位只需将position改为:absolute