我正在尝试制作一个 2x2 网格,它用一张 table 填满 iPhone 的整个窗口。 目前它看起来像这样:http://dl.dropbox.com/u/182509/photo.PNG
请注意右列的压扁和左侧的间隙。
我也无法修复。
相关CSS:
body { margin: 0; position: absolute; height: 100%; }
.full { position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background-color: white; }
table { border-width: 0px; border-spacing: 0px; border-style: hidden; border-color: gray; border-collapse: collapse; background-color: white; width: 100%; height: 100%; left: 0; top: 0px; margin: 0; padding: 0px; position: absolute; }
td { border-width: 1px; padding: 1px; border-style: solid; border-color: gray; background-color: white; width: 50%; height: 160px; }
和 html:
<div id="helpView" class="full">
<table id="help">
<tr>
<td>Hey..</td>
<td>Hi.</td>
</tr>
<tr>
<td>Hello.</td>
<td>Greetings!</td>
</tr>
</table>
</div>
感谢任何帮助
最佳答案
由于您的 td
将边框设置为 1px,它增加了我们所看到的总宽度,因此您必须减小 td
的宽度。引用框模型:
http://www.w3.org/TR/CSS2/box.html
或者您可以将表格的 left
设置为 -1
以将其调整到左侧:
table{left:-1}
它将起作用,因为位置是绝对的。
关于html - 将表格对齐到 div 的最左侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6908843/