这有可能只使用CSS吗?
我试图把屏幕分割成两个空格:
下面是我最好的尝试(小提琴)尝试过的一些示例代码:
HTML:
<body>
<div id="items">
<table>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
<tr>
<td>stuff stss fsfs sfafa sfsfa fsfafafa</td>
</tr>
</table>
</div>
<div id="container">This should expand rest of page width.</div>
</body>CSS:
body {
margin: 0;
padding: 0;
position: absolute;
height: 100%;
}
#items {
height: 100%;
overflow-y: scroll;
border: solid 1px red;
float: left;
}
#container {
min-height: 100%;
border: solid 1px blue;
float: left;
}这非常接近,但是由于第二个div (蓝色边框)无法扩展整个剩余的屏幕宽度,它就会失败。我不想设置%宽度或给任何一个固定的宽度,因为我希望第一个div根据其内容扩展其宽度。
发布于 2013-03-18 19:04:32
这样做:
html, body {
width: 100%;
height: 100%;
}
#left {
position: fixed;
top: 0;
left: 0;
bottom: 0;
overflow-x: hidden;
overflow-y: scroll;
}
#right {
position: fixed;
top: 0;
right: 0;
bottom: 0;
overflow-x: hidden;
overflow-y: scroll; // or not if you don't want it to
}https://stackoverflow.com/questions/15484739
复制相似问题