各セルに画像 (20x20 サイズ) のみが含まれ、追加のスペースがない 2x2 テーブルを作成する必要があります。
画像と表のセルのサイズを強制しようとしましたが、結果の表にはまだ余分なスペースがあります。私は何が欠けていますか?
http://jsfiddle.net/casaschi/M74nN/
HTML
<table id="myTable" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="http://pgn4web.casaschi.net/images/alpha/20/bp.png" />
</td>
<td>
<img src="http://pgn4web.casaschi.net/images/alpha/20/bp.png" />
</td>
</tr>
<tr>
<td>
<img src="http://pgn4web.casaschi.net/images/alpha/20/bp.png" />
</td>
<td>
<img src="http://pgn4web.casaschi.net/images/alpha/20/bp.png" />
</td>
</tr>
</table>
<div id="out"></div>
CSS
table {
width: 40px;
height: 40px;
border: none;
border-collapse: collapse;
border-spacing: 0px;
margin: 0;
padding: 0;
}
td, img {
border: none;
margin: 0;
padding: 0;
width: 20px;
height: 20px;
}
JS
document.getElementById("out").innerHTML = document.getElementById("myTable").offsetWidth + "x" + document.getElementById("myTable").offsetHeight;