简体   繁体   中英

adjust main container width according to table width

Is it possible ..if table width increase then its main container widths increase according to that. Is it possible ??

 <div class="container main-con">
    <table class="table table-hover"> <tr><td></td></tr>
     </table>
  </div>

here if data increase in table then table is coming outside the container. so is it possible to increase width of main container according to table width

Having a container that is wider than the screen is almost always a very bad user experience. People (with good reason) don't like to scroll left and right. Instead you are better off making only your table scroll left/right.

You should be able to achieve this quite easily by making the table responsive. from the Bootstrap docs :

Create responsive tables by wrapping any .table in .table-responsive to make them scroll horizontally

For example:

<div class="table-responsive">
    <table class="table table-hover">
        <tr>
            <td></td>
        </tr>
    </table>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM