隐藏滚动条(启用滚动) [英] Hide scrollbar (with scroll enabled)

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

问题描述

我有一个两列多行的表

<table border=0 id="feed">
    <tr><td>something</td><td><div class="bubble"></div></td></tr>
    <tr><td style="">something1</td><td><div class="bubble"></div></td></tr>
    <tr><td style="">something2</td><td><div class="bubble"></div></td></tr>
    <tr><td style="">something3</td><td><div class="bubble"></div></td></tr>
    <tr><td style="">something4</td><td><div class="bubble"></div></td></tr>
    <tr><td style="">something5</td><td><div class="bubble"></div></td></tr>
    <tr><td>something-else1</td><td><div class="bubble"></div></td></tr>
    <tr><td>something-els2</td><td><div class="bubble"></div></td></tr>
</table>

我希望能够在不显示滚动条的情况下向下滚动(这意味着行的总高度超过了800px的限制).我正在寻找与Chrome/Firefox兼容的修复程序.

I want to be able to scroll down without showing the scrollbar (implying that the total height of the rows exceed the 800px limit) . I am looking for a Chrome/Firefox compatible fix.

饲料的当前属性:

  #feed{
    display: block;height: 800px;overflow-y: scroll;
}

这仅适用于chrome框架:

This only works on the chrome framework:

#feed::-webkit-scrollbar { 
    display: none; 
}

我尝试将父级添加到表中(根据

I tried adding a parent to the table (according to Hide scroll bar, but still being able to scroll):

#outer{
    overflow-y:hidden;
    height:800px;
}
#feed{overflow:scroll;}

HTML:

<div id="outer"><table border=0 id="feed">...</table></div>

请注意,总高度大于800像素,因此滚动应该起作用.但事实并非如此.

Please note that the total height is bigger than 800px so scrolling should work. It does not, though.

推荐答案

您可以这样做:

#feed{
    display: block;
    height: 100px;
    overflow-y: scroll;
    margin-right: -30px;
}

#outer{
    overflow:hidden;
}

这篇关于隐藏滚动条(启用滚动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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