0
我想爲一個具有overflow-x auto的div容器的一部分的div設置一個背景顏色。 我不確定需要應用哪種樣式才能讓div包裝僅在滾動時纔可見的文本。如果我設置了display:block;被設置在div到任何可見:當溢出是auto時,背景顏色不能擴展
<div id="container">
<div class="section">
<div class="title">First</div>
<div class="data">
<table class="table">
<tr>
<td>
First of the rows and all that data
</td>
</tr>
<tr>
<td>
Second of the rows and all that data
</td>
</tr>
<tr>
<td>
Third of the rows and all that data
</td>
</tr>
<tr>
<td>
Fourth of the rows and all that data
</td>
</tr>
</table>
</div>
<div class="title">Second</div>
<div class="data">
<table class="table">
<tr>
<td>
First of the rows and all that data
</td>
</tr>
<tr>
<td>
Second of the rows and all that data
</td>
</tr>
<tr>
<td>
Third of the rows and all that data
</td>
</tr>
<tr>
<td>
Fourth of the rows and all that data
</td>
</tr>
</table>
</div>
</div>
</div>
(例如這裏http://jsfiddle.net/u7ah3/1/) 但是,如果我減少#container的寬度(400〜200),然後滾動時水平可以看出,股利不纏繞文本。 我嘗試使用display:inline-block,但當容器寬度大於節塊時,這不起作用。
謝謝。