html - Add Vertical and Horizontal Scrollbars to HTML5 Tables -


i have table , want make both vertical , horizontal scrollable. when add div , becomes scrollable shrinks smaller size. want table occupy available width of screen , scrollable. rather make table scrolable reduce small size.

below pic of table without div

table without div tag

table shrunk div tag

below code table.

<div id="scroll-table">  <table >  <caption>             list data mysql              </caption>              <tr>                  <th class="center"><strong>id</strong></th>                  <th class="center"><strong>firstname</strong></th>                  <th class="center"><strong>lastname</strong></th>                  <th class="center"><strong>request</strong></th>                  <th class="center"><strong>purpose</strong></th>                  <th class="center"><strong>description</strong></th>                  <th class="center"><strong>booking time</strong></th>                  <th class="center"><strong>access time</strong></th>                  <th class="center"><strong>exit time</strong></th>                  <th class="center"><strong>approved</strong></th>                  <th class="center"><strong>approved by</strong></th>                  <th class="center"><strong>update</strong></th>              </tr>              <?php              if($result->num_rows > 0){                  // output data of each row                  while($rows = $result->fetch_assoc()){ ?>                      <tr>                          <td class="center"><?php echo $rows['id']; ?></td>                          <td class="center"><?php echo $rows['fisrt_name']; ?></td>                          <td class="center"><?php echo $rows['last_name']; ?></td>                          <td class="center"><?php echo $rows['request']; ?></td>                          <td class="center"><?php echo $rows['purpose']; ?></td>                          <td class="center"><?php echo $rows['description']; ?></td>                          <td class="center"><?php echo $rows['booking_time']; ?></td>                          <td class="center"><?php echo $rows['access_time']; ?></td>                          <td class="center"><?php echo $rows['exit_time']; ?></td>                          <td class="center"><?php echo $rows['approved']; ?></td>                          <td class="center"><?php echo $rows['approved_by']; ?></td>                          <td class="center" ><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td>                      </tr>                                                <?php                  }              }              ?>   </table>  </div>  </sect

below code css

 div#scroll-table{    overflow:auto;    }

any suggestion appreciated.

try this,

#scroll-table {   height: auto;   max-height: 180px; // 180px seems work on mobile   overflow: scroll;   border-radius 0px;   -webkit-border-radius: 0px; } #scroll-table::-webkit-scrollbar {  -webkit-appearance: none;  width: 4px;         } #scroll-table::-webkit-scrollbar-thumb {  border-radius: 3px;  background-color: lightgray;  -webkit-box-shadow: 0 0 1px rgba(255,255,255,.75);         } 

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 -