Make Div Scroll When Contents Too Big
I Have This Setup Where the Results Are Wrapped in Span Tags and Are 'Moved' Using Jquery into Other Divs. at the Moment the Search Just Returns 30 Values Max...
I have this setup where the results are wrapped in span tags and are 'moved' using jquery into other divs. at the moment the search just returns 30 values max and it's all good but I don't feel that is a fair limitation. what I want to be able to do is scroll the div when there are more results than can be displayed, like a list box. I've tried a number of different methods but none of them seem to work very well. I'd like it to keep a fixed height too
2 Answers
You haven't shared any markup here but if you are willing to have a fixed height just use this
.container {
/* Optional - You can set a min-height : whatever px; for reserving some space*/
height: 200px; /* Fix a height here */
overflow: auto; /* Optionally you can also use overflow: scroll; */
}
In addition to @mr-alien answer: you can use max-height to limit the size of a container and in the same time to make it fit the content:
.container {
/* Optional - You can set a min-height : whatever px; for reserving some space*/
max-height: 200px; /* Fix a max-height here */
overflow: auto; /* Optionally you can also use overflow: scroll; */
}