Bootstrap: fluid table too wide for window

Bootstrap: fluid table too wide for window

I’m working on a project using twitter bootstrap. We have a table that has lots of columns and is going to be larger than the browser window almost every time.
This is what happens on the right :

The table border stays in the browser window, while the table contents do not. If I scroll, the borders stay where they are, they do not “follow” the browser window.
You can see the problem on this jsfiddle. It works on Safari, not on Chrome or Firefox.
The layout is like this :

… menusidebar here…

I hope you can help me. If you need more information, just ask, I’d be glad to supply.
This is a Rails 3.2 app, using the gem bootstrap-sass in version (the problem appears in too). The first three numbers reflect the bootstrap version.


Solution 1:

Bootstrap has the following style applied to Tables:

table {
    max-width: 100%;

If you override that property in your custom stylesheet it should hopefully solve the problem. Changing it to ‘none’ should work.

table {
    max-width: none;

Solution 2:

This was the only solution that worked for me…

Related:  Should I use normalize.css in my Bootstrap project?

    .table {
        max-width: none;
        table-layout: fixed;
        word-wrap: break-word;

Solution 3:

If you are on Bootstrap 3, another approach is to wrap your table in a

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

This makes the table responsive.

Solution 4:

You can apply the style = “overflow: auto;” to put a horizontal scroll bar at your table. Thus the design will still remain responsive. Follow the code:

    overflow: auto;

And use it on your div:

<div class='span11 table-scrollable'>

Solution 5:

Applying the style = “overflow: auto;” worked just fine for me

Solution 6:

I found solution somewhere in internet…

table {table-layout:fixed}

It solve problems in Firefox & IE, with bootstrap 2 & 3