滚动条表格单元格 [英] scroll bar for a table cell

查看:132
本文介绍了滚动条表格单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将滚动条添加到'td'标签?
我在'td'标签内有一个动态内容。我希望'td'具有固定大小,并且如果内容大于td大小,我希望滚动条仅出现在特定单元格上。有没有办法做到这一点?

解决方案

是的,您可以做到这一点。


$ b $最简单的方法是在你的单元格内填入div并设置它的 overflow 样式属性。



< CSS:

  div.scrollable {
width:100%;
身高:100%;
保证金:0;
padding:0;
溢出:auto;

HTML:

 < td>< div class = scrollable> 
如果一个滚动条对于单元格来说太大了,那么有些内容是
< / div>< / td>

如果您希望滚动条始终可见,即使内容未被裁剪, code> auto with scroll 在CSS中。



示范


Is there a way to add a scroll bar to a 'td' tag? I have a dynamic content inside a 'td' tag. I want the 'td' to be of fixed size and if the content becomes larger than the 'td' size, I want a scroll bar to appear only on that particular cell. Is there a way to achieve this?

解决方案

Yes you can do that.

The easiest way is to put inside your cell a div filling it and set its overflow style property.

CSS :

div.scrollable {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: auto;
}

HTML :

<td><div class=scrollable>
    Some content with a scrollbar if it's too big for the cell
</div></td>

If you want the scrollbar to be always visible, even when the content isn't cropped, replace auto with scroll in the CSS.

Demonstration

这篇关于滚动条表格单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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