【问题标题】:Make text scrollable within div使文本在 div 内可滚动
【发布时间】:2014-07-23 18:18:09
【问题描述】:

我希望将一些冗长的文本包含在 div 中,可以通过向上或向下滚动来查看文本。 现在,“描述”文本呈现为 <%= @pin.description.html_safe %> 并位于 <div class="panel-body> 内(我正在使用 Bootstrap)。

【问题讨论】:

  • 您可以添加panel-body some-class 和样式.some-classmax-height: 100px; overflow-y: auto;

标签: html css ruby-on-rails scrollable


【解决方案1】:

给你的div一个高度并设置overflow: scroll

#elementId{
    height: 200px;
    overflow: scroll;
}

如果您只希望它向上/向下滚动而不是向左/向右滚动:

overflow-y: scroll;

JSFIDDLE

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多