【问题标题】:overflow scroll hide scroll when text doesnt overflow当文本不溢出时溢出滚动隐藏滚动
【发布时间】:2015-01-07 05:28:21
【问题描述】:

当滚动条里面的文字没有溢出容器的高度时,是否可以隐藏滚动条。我想让滚动条在文本溢出或超过高度时可见。

CSS:

div {
    width: 150px;
    height: 150px;
    overflow: scroll;
}

HTML:

<div>
    sample text
</div>

示例 JS:HERE

【问题讨论】:

    标签: html css


    【解决方案1】:

    使用overflow:auto 代替overflow:scroll http://jsfiddle.net/Ly58w9ts/2/

    【讨论】:

    • @MichaelPon 是的,我忘记了
    猜你喜欢
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 2013-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多