How to scroll the specific table horizontally and not all the html page

advertisements

I want to scroll a table horizontal,but on scroll the entire html page get scroll, how can we set scroll to specific div/table and not entire html page


Try putting the table inside a div and put overflow-x:scroll for the div

<div style="width:200px;">
  <div style="overflow-x:scroll;">
   <table style="width:300px;" border="1px">
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
   <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
</table>
    </div>
  </div>