Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you changing default padding bootstrap table cells?

Bootstrap tables cells (td, th) have a default padding of 8px. What's a good way to change it to another value for all bootstrap tables?

like image 499
readonly Avatar asked Feb 16 '15 18:02

readonly


1 Answers

I am assuming your are talking about the bootstrap pre-defined tables and not the grid system. If you want to change all the padding elements on one specific table you can do something like this in your html:

EDIT I switched the code because the other code was not working.

Try this CSS:

.mytable>tbody>tr>td, .mytable>tbody>tr>th, .mytable>tfoot>tr>td, .mytable>tfoot>tr>th, .mytable>thead>tr>td, .mytable>thead>tr>th {
    padding: 12px;
}

Add this class to your table

<table class="table mytable">
   table data here...
</table>

Here is the JS Fiddle here. There are a few other ways to do this like using the !important to over ride other CSS classes but I don't recommend it.

like image 190
crazymatt Avatar answered Oct 17 '22 05:10

crazymatt