Hide scrollbar (with scroll enabled)

拥有回忆 提交于 2021-02-17 02:18:52

问题


I have a table with 2 columns and multiple rows

<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>

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.

Current properties of feed:

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

This only works on the chrome framework:

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

EDIT:

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>

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


回答1:


You can do it like this:

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

#outer{
    overflow:hidden;
}



回答2:


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


来源:https://stackoverflow.com/questions/22194382/hide-scrollbar-with-scroll-enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!