如何在CSS中向表中添加滚动条? [英] How to add scrollbar to table in CSS?

查看:104
本文介绍了如何在CSS中向表中添加滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有div,我有桌子,我正在使用循环添加表格行。

我的div大小是固定的,当在表中添加更多行时,滚动条应该是可见的。





如何做到这一点?

谢谢



我尝试过:



Hi,

I have div in that i have table, and I am adding table row using loop.
my div size is fixed, when in table more row added then scrollbar should be visible.


how to do this?
thanks

What I have tried:

<div style="overflow-x:auto!important;">
<table style="width:90%;" >
   <tr style="font-size:1.5em;"><td>Value</td><td>Time</td></tr>
      @foreach (var itemModel in item)
      {
         <tr style="font-size:1em;">
         <td>@itemModel.Value</td>
         <td>@itemModel.Timestamp</td>
         </tr>
                                            }
</table>
</div>

推荐答案

参考这个链接它应该有帮助



使用HTML和CSS滚动表格 - 堆栈溢出 [ ^ ]
Refer this link it should help

Table scroll with HTML and CSS - Stack Overflow[^]


这篇关于如何在CSS中向表中添加滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆