html - Table inside scrollable container still causes container width to grow -


i using bootstrap grid. facing strange issue displaying tables inside bootstrap column.

i have table columns, displayed inside div (table container). table container has col-md-9 bootstrap class, width set 75%. however, @ point if table contains content and/or column, causes container's width expand. here standalone example: https://output.jsbin.com/xowihu

here screenshot. notice gray box getting pushed outside, causing layout broken: issue

and, when removed columns table, works , looks expected: expected

the thing confuses me that, have specified overflow: scroll on table container. why content length affecting container width?

i have tried:

  • setting table-layout: fixed on table, , word-wrap: break-word on table cells. works, table contents visually horrible; 1 word broken 3 lines, etc.
  • setting max-width on table container works, has in px unit. might last resort (and applied via javascript) since site has various layout widths.

edit link code: https://jsbin.com/xowihu/edit

when put <div class="row"> inside <table class="table"> outside table,tr,td works fine..

<div class="col-md-7 slide-content">     <p>       lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.     </p>     <div class="row">               <div class="col-sm-9">                 <div class="row">                   <div class="col-sm-2" style="height: 250px; background-color: lightgreen">some label</div>                   <div class="col-sm-9 scrollable">                     <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. exercitationem libero sequi tempore necessitatibus tempora, porro, iure, nisi dicta, rerum enim natus facilis voluptatum soluta dolore molestias vero odit eaque veniam.</p>                     <table class="table" border="1" cellpadding="1" cellspacing="1">                       <tbody>                         <tr>                           <td>hello</td>                           <td>lipsumdolor</td>                           <td>lipsum gen</td>                           <td>lorem ipsum dolor sit amet</td>                           <td>lorem ipsum dolor</td>                           <td>lorem ipsum</td>                           <td>lorem ipsum</td>                           <td>lorem ipsum</td>                           <td>lorem ipsum</td>                         </tr>                         <tr>                           <td>hello</td>                           <td>lipsumdolor</td>                           <td>lipsumlipsumlipsumlipsum</td>                           <td>lorem ipsum dolor sit amet</td>                           <td>lorem ipsum dolor</td>                           <td>lorem ipsum</td>                           <td>lorem ipsum</td>                           <td>lorem ipsum</td>                           <td>lorem ipsum</td>                         </tr>                         <tr>                           <td>hello</td>                           <td>lipsumdolor</td>                           <td>lipsum gen</td>                           <td>lorem ipsum dolor sit amet</td>                           <td>lorem ipsum dolor</td>                           <td>qwertyuiop</td>                           <td>qwertyuiop</td>                           <td>qwertyuiop</td>                           <td>qwertyuiop</td>                         </tr>                       </tbody>                     </table>                   </div>                  </div>               </div>               <div class="col-sm-3">                 <img src="https://placehold.it/120x120"><br>                 <a href="#">click enlarge</a>               </div>             </div><table class="table">       <tbody>         <tr>           <td>            </td>         </tr>       </tbody>     </table>   </div> 

so did was, div class="row" inside

<table class="table">   <tr>     <td> 

and put underneath

<div class="col-md-7 slide-content"> 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -