有没有可能有一个有效但不可见的溢出?

时间:2013-10-08 13:09:36

标签: html css overflow invisible

我只是想知道是否存在隐藏滚动条的可滚动区域(即overflow: scroll)的任何解决方案?谷歌搜索时我没有找到解决方案,所以我在这里问。如果可以使用CSS,那将会很酷。但如果有JS或php的解决方案,我仍然想知道。

1 个答案:

答案 0 :(得分:2)

通过将container绝对定位在与隐藏溢出相对定位的外部容器中,您可以隐藏第一个外部容器的滚动条。

所以滚动条仍在那里,但你将无法看到它。

    #outer {
        position: relative;
        width: 200px;
        height: 300px;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
    #inner {
        position: absolute;
        left: 0;
        top: 0;
        right: -30px;
        bottom: 0;  
        padding-right: 15px;
        overflow-y: scroll;
    }

的jsfiddle: http://jsfiddle.net/g6URf/

相关问题