中心表与Twitter Bootstrap 2

ahm*_*hmy 18 css twitter-bootstrap

我有一张桌子,我希望宽度为span5并使其水平居中.

我怎么能用Twitter Bootstrap 2做到这一点?

Sim*_*ham 25

创造一种新的风格 -

.center-table
{
  margin: 0 auto !important;
  float: none !important;
}
Run Code Online (Sandbox Code Playgroud)

并将其应用于表格 -

<table class="span5 center-table">
  <tr>
    <td>This is a centered table</td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

  • 只是为了编织,遵循bootstraps"命名约定",你应该调用类.table-centered xD (4认同)