简体   繁体   English

根据工作台宽度调整主容器宽度

[英]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 : Bootstrap文档

Create responsive tables by wrapping any .table in .table-responsive to make them scroll horizontally 通过将任何.table包装在.table-response中以使其水平滚动来创建响应表

For example: 例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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