我有這樣的代碼:居中文本在表格中Twitter的引導
<table class="table">
<thead>
<tr>
<th>1</th>
<th>1</th>
<th>1</th>
<th>1</th>
<th>2</th>
<th>2</th>
<th>2</th>
<th>2</th>
<th>3</th>
<th>3</th>
<th>3</th>
<th>3</th>
<th>4</th>
<th>4</th>
<th>4</th>
<th>4</th>
<th>5</th>
<th>5</th>
<th>5</th>
<th>5</th>
<th>6</th>
<th>6</th>
<th>6</th>
<th>6</th>
<th>7</th>
<th>7</th>
<th>7</th>
<th>7</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4">Lorem</td>
<td colspan="4">ipsum</td>
<td colspan="4">dolor</td>
<td colspan="4">sit</td>
<td colspan="4">amet</td>
<td colspan="4">Lorem</td>
<td colspan="4">ipsum</td>
</tr>
</tbody>
</table>
@import url('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');
table,
thead,
tr,
tbody,
th,
td {
text-align: center;
}
出於某種原因,該表中的文本仍然不居中。爲什麼?如何將表格中的文字居中?
爲了讓它真的很清楚:例如,我想讓「Lorem」坐在四個「1」的中間。
在以後的版本中有一個文本中心類。 – 2013-03-21 21:04:42
注意:.table td {text-align:center; }將集中你所有的TDs – rbp 2013-04-02 15:00:22
@ xr09是的,'.text-center',但是.table td'的特殊性仍然會失敗。這就是爲什麼引導程序應該從標記名開始,而不是直接啓動到像'.table'這樣的類中。 – Sinetheta 2013-05-22 17:35:22