1 reply [Last post]
gidmeister
gidmeister's picture
Offline
Regular
NY
Last seen: 5 years 46 weeks ago
NY
Timezone: GMT-4
Joined: 2011-03-01
Posts: 47
Points: 93

I declared a div as follows:

#scrollDiv {
        word-wrap: break-word;
        width: 200px;
        max-width: 200px;
        min-width: 200px;
        height: 300px;
        max-height: 300px;
        min-height: 300px;
        overflow-y: scroll;   
 
    }

As you can see, I want a scroll bar to appear if there is too much content and the user has to scroll down. But I just want a vertical scrollbar. If a line is too wide, I do not want a horizontal scroll bar, but I also don't want it to be truncated. I want it to wrap to the next line.
The above CSS does not do that.
What is the answer?

gidmeister
gidmeister's picture
Offline
Regular
NY
Last seen: 5 years 46 weeks ago
NY
Timezone: GMT-4
Joined: 2011-03-01
Posts: 47
Points: 93

I found the problem -

I found the problem - sometimes the html within the div contains other divs, and they can have a width of 1400 pixels, and that forces the outer div to have a scroll bar, no matter what max-width you give the outer div.