Html css:让表格填满整个站点
我有一个测试站点,它的主体中只有这个:Html css:让表格填满整个站点,html,css,Html,Css,我有一个测试站点,它的主体中只有这个: <div id="tableHolder"> <table style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; border: 1px solid"> <tr> <td> <div id="image-canvas" style="width: 800px; height: 600
<div id="tableHolder">
<table style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; border: 1px solid">
<tr>
<td>
<div id="image-canvas" style="width: 800px; height: 600px"></div>
</td>
<td valign="top">
<div id="list" style="width:400px; overflow: auto; height: auto; max-height: 600px; resize: vertical;"></div>
</td>
</tr>
</table>
</div>
我怎样才能使这个填充整个网站,而不是只有1200x600像素?
单独设置100%并没有帮助。正如那些家伙所说,增加桌子的宽度和高度。接下来是代码更改(我还将边框更改为5,并将其颜色更改为红色以使其更可见)。我在firefox、Chrome和IE中试用过:
<div id="tableHolder">
<table style="height:100%;width:100%;position: absolute; top: 0; bottom: 0; left: 0; right: 0; border: 5px solid red">
<tr>
<td>
<div id="image-canvas" style="width: 800px; height: 600px"></div>
</td>
<td valign="top">
<div id="list" style="width:400px; overflow: auto; height: auto; max-height: 600px; resize: vertical;"></div>
</td>
</tr>
</table>
</div>
重要提示:如果更改div“tableHolder”样式,表将看起来很糟糕,这就是我更改表样式而不是div样式的原因。为了证明这一点,我将发布带有div样式更改的代码:
<div id="tableHolder" style="height:100%;width:100%;background:yellow;">
<table style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; border: 5px solid red">
<tr>
<td>
<div id="image-canvas" style="width: 800px; height: 600px"></div>
</td>
<td valign="top">
<div id="list" style="width:400px; overflow: auto; height: auto; max-height: 600px; resize: vertical;"></div>
</td>
</tr>
</table>
</div>
如果你想稳妥起见,两个都要换 你的问题并没有真正让我知道你在寻找什么,但这是有效的: 增加高度:100%;和宽度:表元素的100%
<div id="tableHolder">
<table style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; border: 1px solid;width:100%;height:100%">
<tr>
<td>
<div id="image-canvas" style="width: 100%; height: 100%"></div>
</td>
<td valign="top">
<div id="list" style="width:100%; overflow: auto; height: min-height; max-height: 100%; resize: vertical;"></div>
</td>
</tr>
</table>
</div>
在表格中添加“宽度:100%”。加布里埃尔:嗯,高度是多少?添加宽度:100%;高度:100%符合款式,效果很好。是的,它是正确的。。。再加上“高度:100%”。对不起,忘了提一下,我试着把它分成80%和20%。80对于图像20对于列表,我尝试获得80%20%的垂直分割。对不起,忘了提了。