Bootstrap: text-center Does Not Affect Table Header

Created on 24 Mar 2015  路  2Comments  路  Source: twbs/bootstrap

In the following example, text-center does not affect the table header. The text in table body is displayed normally (center aligned) but not the header
<table class="table table-condensed table-hover text-center">
<thead>
<tr>
<th class="text-center">Room Id</th>
</tr>
</thead>

css

Most helpful comment

We set th { text-center: left; }, which is more specific than the class on the parent <table> and thus prevents the header cell from inheriting the centering styles. Putting the .text-center class directly on the <th> should work though (confirmed in the docs).

As our documentation for the text alignment classes shows them being used on paragraphs and doesn't claim compatibility with tables, I'd recommend using custom CSS to override Bootstrap's table header styles instead of using alignment classes in this situation.

/cc @mdo to confirm or deny

All 2 comments

We set th { text-center: left; }, which is more specific than the class on the parent <table> and thus prevents the header cell from inheriting the centering styles. Putting the .text-center class directly on the <th> should work though (confirmed in the docs).

As our documentation for the text alignment classes shows them being used on paragraphs and doesn't claim compatibility with tables, I'd recommend using custom CSS to override Bootstrap's table header styles instead of using alignment classes in this situation.

/cc @mdo to confirm or deny

Ok thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knownasilya picture knownasilya  路  3Comments

iklementiev picture iklementiev  路  3Comments

athimannil picture athimannil  路  3Comments

ghost picture ghost  路  3Comments

tiendq picture tiendq  路  3Comments