Making wide table fit bootstrap container

前端 未结 5 1754
情深已故
情深已故 2020-12-14 05:44

I have a table like so:




    

         


        
相关标签:
5条回答
  • 2020-12-14 06:17

    Adding style to the <td> seemed to fix this

    <td style ="word-break:break-all;">

    0 讨论(0)
  • 2020-12-14 06:18

    Try applying class="row" for the <tr> elements.

    Use rows to create horizontal groups of columns. Content should be placed within columns, and only columns may be immediate children of rows.

    -- Bootstrap css docs

    note that Rows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding, so you might want to apply class=container-fluid for the table or a parent of it.

    0 讨论(0)
  • 2020-12-14 06:24

    I fixed the same issue by changing <div class="container">...</div> to <div class="container-fluid">...</div>

    0 讨论(0)
  • 2020-12-14 06:30

    I think this is what you are trying to achieve?

    A table inside a panel-body that doesn't overflow due to the panel-body padding?

    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="panel-body">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>A</th>
                                <th>B</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr><td>1</td><td>2</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    

    http://jsfiddle.net/52VtD/4215/

    and your full sample:

    http://jsfiddle.net/52VtD/4216/

    0 讨论(0)
  • 2020-12-14 06:40

    You must add this class to the container so it will be like this:

    <div class="table-responsive fixed-table-body">
    

    OR

    <div class="table-responsive table-body">
    
    0 讨论(0)
提交回复
热议问题