Make text scrollable within div

大城市里の小女人 提交于 2019-12-10 17:14:02

问题


I am looking to make some lengthy text contained into a div where the text can be viewed by scrolling up or down. Right now the "description" text is rendered like so <%= @pin.description.html_safe %> and is inside a <div class="panel-body> (I'm using Bootstrap).


回答1:


Give your div a height and set overflow: scroll

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

If you only want it to scroll up/down and not left/right use:

overflow-y: scroll;

JSFIDDLE



来源:https://stackoverflow.com/questions/24917983/make-text-scrollable-within-div

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