<div id="container">
<div class="main_div">
<div class="cell1">1</div>
<div class="cell2">2</div>
<table>
<tr>
<td > The Tag </td>
<td> The Tag </td>
.....
more data
</tr>
</table>
</div>
</div>
</body>
</html>
Here the Table won't fit the container when I try to do. How can achieve to fit the table in "container tag? any idea?
CSS
#container{
margin:0 auto;
width:640px;
}
Table
width:900px;
/* 我应该如何将容器缩小到表格宽度 */还是没有解决方案? 我的容器有左右两侧的间隙,当我包括 table 时它看起来很奇怪并且不适合容器盒?
最佳答案
您无法将 900 像素的表格放入 640 像素的容器中。最好在其中一个中声明宽度并让另一个采用该宽度:
#container { width: 900px; }
table { width: 100%; }
关于html - 将表格放在 div 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3334356/