PDA

View Full Version : A css Div question (scroll boxes)




torndownunit
Feb 9, 2009, 05:05 PM
I am having problems with the correct wording to do a Google search for this, so I am hoping someone here can help me.

I have a small div 'box' for text. Is it possible to have that box automatically resize to a certain point, but if it gets bigger than that have it change to a scrolling box?

I can make a box that auto sizes to the content, or a fixed box that scrolls. I don't know how to combine to the 2, or if I can.

Thanks a lot.



Mal
Feb 9, 2009, 05:07 PM
You're looking for max-width and max-height. Don't set specific dimensions, or do it using percentages, then set a max-width or max-height (or both, and probably also min-width and min-height), and the box will not grow beyond that size. Then apply your overflow properties, and you're in good shape!

jW

angelwatt
Feb 9, 2009, 05:51 PM
A note about the above advice is that IE6 doesn't understand the min-/max- width/height properties.

Photomax
Feb 9, 2009, 06:06 PM
A note about the above advice is that IE6 doesn't understand the min-/max- width/height properties.

There are work arounds for this but at this stage the best full implementation for conditional IE6 CSS styling is display:none

Max