How can I give vertical scroll bar to a html table

Polachan Paily 226 Reputation points
2021-06-04T11:49:46.067+00:00

I am trying to give vertical scrollbar to a html table but the problem is after giving the scroll bar , all alignment of the header and its value going wrong all placed in wrong position. How can give vertical scroll bar to a html data table , Please help
Here is the code

cb91vpfn

Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} vote

Accepted answer
  1. Yogi 351 Reputation points
    2021-06-06T11:56:11.073+00:00

    for verticle scrollbar you can use the following:

    <div style="height: 150px; overflow: auto">
      <table style="height: 400px">
         ....
      </table>
    </div>
    

    Here table height is 400 px which is bigger than the height of 150px set for it's parent div. So we will see vertical scrollbar.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.