twitter-bootstrap – 在Twitter Bootstrap中的表中居中文本
发布时间:2020-12-17 23:48:53 所属栏目:安全 来源:网络整理
导读:我有这个代码: table class="table" thead tr th1/th th1/th th1/th th1/th th2/th th2/th th2/th th2/th th3/th th3/th th3/th th3/th th4/th th4/th th4/th th4/th th5/th th5/th th5/th th5/th th6/th th6/th th6/th th6/th th7/th th7/th th7/th th7/th
我有这个代码:
<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; } Fiddle 由于某些原因,表中的文本仍然不居中。为什么?如何将文本放在表格中心? 要使它真的清楚:例如,我想“Lorem”坐在四个“1”的中间。 解决方法
.table td的文本对齐设置为left,而不是center:
添加此应该居中: .table td { text-align: center; } 更新小提琴:http://jsfiddle.net/JeCpZ/1/ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |