End of overflow away from the table

Asked

Viewed 26 times

0

I have a table with style="overflow: auto;, only that the scroll is down there, almost 1 finger away from the table.

<div style="overflow: scroll; height: 240px; width: 1000px;">
    <table border="1" class="table table-bordered" id="tabela" style="background-color: white;"> 
                            
         <tr>
             <h5>Usuários</h5>
         </tr>
                            
         <tr>
             <th>Nome</th>
             <th>Nome</th>
         </tr>
         <tr>
             <td>João</td>
             <td>Maria</td>
         </tr>
         <?php endwhile; ?>
    </table>
</div>

Follow the print:

Print

  • But it’s not just diminishing the height of the div??

  • No, the table is down, but the scroll is down there yet.

  • If only to 'take off' the scroll when it is not necessary overflow: auto (you are using scroll)

  • Do you want to keep the scroll horizontal? There is a need for it?

  • There’s no need for the horizontal, it’s there to be.

  • And I need to leave the table at that height size

Show 1 more comment

1 answer

0

Just remove the fixed height of your table, without it the overflow will always be below the table

<div style="overflow: scroll;width: 1000px">
    <table border="1" class="table table-bordered" id="tabela" style="background-color: white;"> 
                            
         <tr>
             <h5>Usuários</h5>
         </tr>
                            
         <tr>
             <th>Nome</th>
             <th>Nome</th>
         </tr>
         <tr>
             <td>João</td>
             <td>Maria</td>
         </tr>
         <?php endwhile; ?>
    </table>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.