Alan2
Alan2

Reputation: 24572

How can I add scrolling to a <div> if the contents of the <div> are too big to fit?

I am using the following with AngularJS:

<div style="width: 725px; height: 200px;" 
 data-ng-bind-html-unsafe="question.text"></div>

Is there a way that I can add a scroll to this so that it will accept any size of contents:

Upvotes: 0

Views: 61

Answers (2)

Samuel Lindblom
Samuel Lindblom

Reputation: 819

Your container (div) already has a fixed height, so use the css property overflow-y: scroll. Note that it is not supported in IE < 8.

Upvotes: 2

Nitesh
Nitesh

Reputation: 15759

Use overflow-y and a fixed height. This will add scrolling to the div.

For instance

<div style="width: 725px; height: 200px; overflow-y:scroll;" data-ng-bind-html-unsafe="question.text">
</div>

Hope this helps.

Upvotes: 1

Related Questions