2012-07-08 48 views
0

工作我有类的表=列表,其输出被上传到服务器,它是使用php.The表动态创建的文件是在另一个内部div.The代码是滚动不能在动态表

<div class="list"> 
<table>....php code for table...</table> 
</div> 

我已经定位在固定position.The CSS文件股利列表

.list{background:#66CDAA;width:20cm;position:fixed;top:3cm;left:11cm;} 

的问题是,如果表变得太大的页面doen't向下滚动。我曾尝试过:

body{overflow:auto} 

但它不起作用。 作为alernative解决方案,我知道,我可以添加到.LIST

.list{overflow:auto;height:something;} 

但随后的名单将有我不想,也表将滚动,而不是页面的固定高度。 那么有没有其他的选择?

回答

0

试试这个:

<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%; 
} 
+0

这给了相同的结果。为什么添加一个额外的类会改变结果? – takis 2012-07-08 19:00:43

+0

这应该给一个固定大小的容器,以限制实际盒子的最大尺寸。 – 2012-07-08 19:04:04

+0

但我不想有一个框的最大尺寸。我希望高度根据它输出的文件数来改变。问题是,如果页面太多,页面不滚动 – takis 2012-07-08 19:07:14