question

PolachanPaily-2805 avatar image
1 Vote"
PolachanPaily-2805 asked Bruce-SqlWork commented

How can I give vertical scroll bar to a html table

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


dotnet-aspnet-core-mvc
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

yogyogi avatar image
0 Votes"
yogyogi answered Bruce-SqlWork commented

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.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks Yogyyogi, but the problem is the header is not fixed. The header is also going scrolling . I want to make header fixed.



1 Vote 1 ·
yogyogi avatar image yogyogi PolachanPaily-2805 ·

For fixing header make it sticky with CSS see this link.


0 Votes 0 ·

yogyogi, The link you have given here is not working, Please can you help me with the suggested code using my code

Thanks

0 Votes 0 ·
Show more comments