jazzblue
jazzblue

Reputation: 2437

html <div> horizontal scroll bar would not show

I saw there are similar questions out there, but no answer that helped me. So I am trying to have a with a horizontal scroll bar. However, the following code wraps the text around instead of horizontal scrolling. Why is this happening?

<div style="height:120px;width:120px;overflow-x:scroll;overflow-y:scroll;">
As you can see, once there's enough text in this box, the box will grow scroll bars... that's why we call it a scroll box! You could also place an image into the scroll box.
</div>

Upvotes: 1

Views: 256

Answers (1)

Joey
Joey

Reputation: 1370

Add white-space: nowrap to the style of the div tag.

Upvotes: 2

Related Questions