Question

Can you please take a look at this link (Please scroll down to the end of page )and let me know why"
1- Table is not actinf responsive? 2- I want able to control <td> widths by using col-md-3 and col-lg-3 does this works in table as well?

Here is the code I have:

<div class="col-md-offset-1  col-lg-offset-1 col-md-6    col-lg-6">
<table class="table table-hover table-responsive">
<tbody>
<tr>
<td width="174"><strong>7:30 – 8:45 a.m.</strong></td>
<td>Arrival / Health CheckFree Choice in Activity Areas, books, puzzles, matching games, large block building, small blocks, floor toys, Lego, trucks and car play.</td>
</tr>
<tr>
<td><strong>8:45 – 9:00 a.m.</strong></td>
<td>Clean-up, toileting, wash up for snack</td>
</tr>
<tr>
<td><strong>9:00 – 9:30 a.m.</strong></td>
<td>Morning snack</td>
</tr>
<tr>
<td><strong>9:30 -10:00 a.m.</strong></td>
<td>Circle Time: Action songs, singing time, finger plays, hello songs, discussion of daily activities</td>
</tr>
   </tbody>
</table>
</div>

AS you can see I couldn't control the table size with col-md-3 and col-lg-3 so I wraped it in a div but the responsive is not working

Was it helpful?

Solution

Please re-read the docs on this feature. The table-responsive class needs to be on a wrapper div, not the table itself.

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>

OTHER TIPS

.table-responsive should be on wrapper div because even if you use css property overflow:scroll scrollbar will not active on table tag so we are using a wrapper div with class table-responsive to show to scroll bar to make table responsive.

This is the reason we need to write responsive table code like this

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>

It does work to set the table-responsive class on the table itself if you also set the table to display: block. It's generally better to just use the wrapper div though.

I wrap all my tables with the following class. Bootstrap or otherwise and it works every time.

.respTable {
   overflow-y: scroll;
   margin: 5px;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top