我有以下代碼:我怎樣才能讓我的顯示器:表; DIV填充包含它的DIV的橫向寬度?
<div class="rep_tb0" style="width: 100%">
<div class="rep_tr0" style="width: 100%">
<div class="rep_td0" style="width: 100%" id="ActivityLog">Activity Log</div>
</div>
</div>
.rep_tb0 {display: table; }
.rep_tb0 {padding: 5px;}
.rep_tb0 {border-collapse:collapse; }
.rep_tr0 {display: table-row;}
.rep_td0 {display: table-cell; padding: 5px; vertical-align:top; }
.rep_td0 {border: 1px solid #666; }
我想是有字的活動日誌,以水平方向延伸,以填補包含它的DIV表。請注意,DIV有一個寬度設置,但它可能很容易改變。正如你所看到的,我嘗試在三個地方設置寬度,但都沒有工作。
如何在不設置像素寬度的情況下水平填充區域。
請不要忘記我正在使用display:table;這些不是正常的DIV :-)
你爲什麼需要這些表相關的'display'值? –
當我測試這個代碼時,「rep_td0」佔據了整個寬度,就像它應該做的那樣。你正在使用哪種瀏覽器?你確定你不需要桌子嗎?一切都好,如果它是用來顯示一些數據..! – MatTheCat
它正在顯示數據。 –