Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Responsive Table Not Acting Responsive

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

like image 688
Mona Coder Avatar asked Nov 21 '13 22:11

Mona Coder


People also ask

How do I make my bootstrap table mobile responsive?

You can make any table responsive across all viewports by wrapping a . table with . table-responsive class. Or, pick a maximum breakpoint with which to have a responsive table up to by using .

How do I make my table responsive?

Responsive tables with flexboxOrder markup exactly how a mobile or screen reader should read it, use semantic headers and content. Abandon all concept of 'row' wrappers. Set the width of each cell as a percentage based on number of columns or rows. Auto sizing column widths is not possible.

Is bootstrap always responsive?

Always responsive Across every breakpoint, use .table-responsive for horizontally scrolling tables.

Which class is used for table responsiveness in bootstrap?

Use . table-responsive{-sm|-md|-lg|-xl} classes as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally.


2 Answers

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>
like image 92
ceejayoz Avatar answered Oct 22 '22 11:10

ceejayoz


.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>
like image 37
Gaurav Aggarwal Avatar answered Oct 22 '22 12:10

Gaurav Aggarwal