Tushar Kotlapure
Tushar Kotlapure

Reputation: 338

how to keep vertical scroll bar aligned to right side of the page with respect to horizontal scroll bar

In my web page I have a table which is larger than my page length. So I have applied horizontal scrollbar also i have vertical scroll bar for the same but the problem is it is aligned to end of the table. So user can't see that scroll bar on first view. If user scrolls horizontally to end of the table then only he can see there is a vertical scroll. Is there any way tokeep vertical scroll aligned to right side of the page ?

Upvotes: 0

Views: 1389

Answers (1)

YoungLearnsToCoding
YoungLearnsToCoding

Reputation: 427

simply set outer div width as 100% viewport and overflow: auto or scroll

<div>
display something else on page...
</div>
<div style="width:100%;height:150px;overflow:scroll;border:1px solid red">
  <table style="width:1000px;height:500px;table-layout: fixed;">
    <tr>
      <td>a</td>
    </tr>
    <tr>
      <td>b</td>
    </tr>
    <tr>
      <td>c</td>
    </tr>
    <tr>
      <td>d</td>
    </tr>
  </table>
</div>
<div>
display something else on page...
</div>

Upvotes: 1

Related Questions