我有一个带有 class=list 的表,它输出上传到服务器的文件,它是使用 php 动态创建的。该表在另一个 div 中。代码是
<div class="list">
<table>....php code for table...</table>
</div>
我已经把div列表定位到固定位置了,css文件是
.list{background:#66CDAA;width:20cm;position:fixed;top:3cm;left:11cm;}
问题是如果表格变得太大,页面不会向下滚动。我试过:
body{overflow:auto}
但它不起作用。 作为替代解决方案,我知道我可以添加到 .list
.list{overflow:auto;height:something;}
但是列表会有一个我不想要的固定高度,而且表格会滚动而不是页面。 那还有什么办法吗??
最佳答案
试试这个:
<div class="listcontainer"><div class="list"><table>...</table></div></div>
CSS:
.listcontainer {
position: fixed;
width: 20em;
top: 3cm;
left: 11cm;
bottom: 3cm;
right: 11cm;
overflow: auto;
} /* adjust right and bottom to be what the maximum size should be */
.list {
background-color: #66cdaa;
max-height: 100%;
}
关于css - 滚动不适用于动态表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11385597/