Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table-responsive class does not take full width #24638

Closed
davidism opened this issue Nov 1, 2017 · 14 comments
Closed

table-responsive class does not take full width #24638

davidism opened this issue Nov 1, 2017 · 14 comments

Comments

@davidism
Copy link

davidism commented Nov 1, 2017

This was previously reported in #24256, which was closed after #24438 was merged. However, that merge was only documentation, and the issue doesn't actually appear to be fixed in Beta 2.

A table with the table-responsive class will not render at full width. I'm not sure why it works in the example in the docs, but this codepen demonstrates that the issue still persists.

<table class="table table-responsive">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
      <th>Link</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>David</td>
      <td>Developer</td>
      <td>None</td>
    </tr>
  </tbody>
</table>

screenshot_2017-11-01_12-00-12

screenshot_2017-11-01_12-01-01

The issue occurs on both Firefox 58 and Chrome 62.

@browner12
Copy link
Contributor

simple solution, use a wrapping <div> with the table-responsive class.

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

@davidism
Copy link
Author

davidism commented Nov 1, 2017

OK, but why doesn't the documentation example need that?

@jipexu
Copy link
Contributor

jipexu commented Nov 1, 2017

good question .... this is the display block in .table-responsive and yes the table not take full width...

@tmorehouse
Copy link
Contributor

tmorehouse commented Nov 1, 2017

In the documentation examples, the reason it appears to "work" is that there is enough content in the table to force it to full width inside the container. Remove a few columns in the example table and you will see that it doesn't span full width.

@jipexu
Copy link
Contributor

jipexu commented Nov 1, 2017

true

@matthewmalone
Copy link

+1 to get the documentation updated, please!

@FTWinston
Copy link

Is it definitely the intention that the table-responsive class not be put on a table any more?

Or is that just a workaround? Cos it seems a bit weird.

@shtse8
Copy link

shtse8 commented Nov 22, 2017

It seems we should have to wait for the next release.

@tmorehouse
Copy link
Contributor

tmorehouse commented Nov 26, 2017

One other caveat with placing table-responsive on the table element is for screen readers.

When a <table> has a CSS display of any value other than table, the table is no longer presented to screen readers as being a table structure, and requires placing an explicit role on each element within the table (i.e. table, rowgroup, row and gridcell)

@mdo
Copy link
Member

mdo commented Dec 22, 2017

Stylistically I've preferred the narrower tables on larger screens, and I've stated it's intentional. However, for the a11y reason alone, we'll fix this up.

@suraj3103
Copy link

simple solution, use a wrapping <div> with the table-responsive class.

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

THANKS MAN

@dsm-72
Copy link

dsm-72 commented Jun 9, 2022

@browner12 Nope not doing it for me. Any other ideas? Note that the div and the table when view with inspector are 100% but the thead and tbody are not

@suraj3103
Copy link

suraj3103 commented Jun 10, 2022 via email

@kamleshwebtech
Copy link

simple solution, use a wrapping <div> with the table-responsive class.

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

This does not work if table-responsive div is inside a table's td. Any solution?? Please suggest me. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests