私は同様の問題に遭遇し、解決策を見つけました。テーブルの幅には依存しませんが、少しトリッキーです。IE5.5、IE6 以降を含むすべてのブラウザで動作します。
<style>
.tablediv {
float:left; /* this is a must otherwise the div will take a full width of our page and this way it wraps only our content (so only the table) */
position:relative; /* we are setting this to start the trickie part */
padding-top:2.7em; /* we have to set the room for our spans, 2.7em is enough for two rows otherwise try to use something else; for one row e.g. 1.7em */
}
.leftspan {
position:absolute; /* seting this to our spans will start our behaviour */
top:0; /* we are setting the position where it will be placed inside the .tablediv */
left:0;
}
.rightspan {
position:absolute;
top:0;
right:0;
}
</style>
<div class="tablediv">
<span class="leftspan">Left text</span>
<span class="rightspan">Right text <br /> with row</span>
<table border="1">
<tr><td colspan="3">Header</td></tr>
<tr><td rowspan="2">Left content</td><td>Content</td><td rowspan="2">Right content</td></tr>
<tr><td>Bottom content</td></tr>
</table>
</div>
<!-- If you don't want to float this on the right side of the table than you must use the clear style -->
<p style="clear:both">
something that continues under our tablediv
</p>
何らかの理由でフロートを使用できない場合は、私が間違って見つけた別の .tablediv スタイルを使用できます。float:left; to display:inline-block;
これは最新のすべてのブラウザーで機能しますが、IE7 以下では機能しません。
今、あなたは私の主張を理解しています。他の解決策が見つかると確信しています。.tablediv が内部コンテンツと同じ長さになることを忘れないでください。そのため、段落を配置すると、表よりも大きなサイズに引き伸ばされます。