让文字在div内滚动 [英] Make text scrollable within div
本文介绍了让文字在div内滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我期望在 div
中包含一些冗长的文本,其中可以通过向上或向下滚动来查看文本。
现在描述文本呈现为像<%= @ pin.description.html_safe%>
,并位于< div class =panel-body>
(我正在使用 Bootstrap )。 方案
给你的 div
一个高度并设置 overflow:scroll
#elementId {
height:200px;
overflow:scroll;
}
$ c
$ p
$ b $ p
$ b $ overflow-y:scroll;
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).
解决方案 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;
这篇关于让文字在div内滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文