Make Text Scrollable Within Div

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

1 Answer

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest