Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define horizontal initial scrolling point

I have an element that contains a fixed width table, and when the screen size became smaller, the table can be scrolled horizontally. My question is, is there a way to define the initial scrolling point, lets say, 50px from the left?

body {margin: 0}

.wrapper {
  overflow-x: scroll;
}

table {
  width: 800px;
  border: 1px solid;
}

th, td {text-align: center; border: 1px solid}
<div class="wrapper">
  <table>
    <tr>
      <th colspan="3">Heading</th>
    </tr>
    <tr>
      <td>Data 1</td>
      <td>Data 2</td>
      <td>Data 3</td>
    </tr>
  </table>
</div>
like image 343
Fernando Souza Avatar asked Dec 02 '25 22:12

Fernando Souza


1 Answers

Another way you can use

                              $(".wrapper").css("scrollLeft","50")
like image 138
Ahmad Mukhtar Avatar answered Dec 04 '25 14:12

Ahmad Mukhtar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!