PDA

View Full Version : Size element so it is exactly as tall as it needs to be to not scroll



artlung
23 Jun 2010, 1:57 PM
Size element so it is exactly as tall as it needs to be to not scroll
I am working on a tool to allow creating small "notes" that I then turn into `Ext.Draggable` items. What I would like to do is to have these items be sized no taller than they need to be.

The elements are absolutely positioned: set `position: absolute` with `top` and `left` and `height` and `width` values in-line. The problem is that the height values are not really very reliable.

Is it possible to set the size at something very short (say 3px), then increment the height until the scrollbars disappear? How can I tell when that occurs, and can I do it in a way that's reliable across browsers?

Code is here: http://github.com/artlung/ArtLung-Notes/blob/master/v2/index.js

artlung
23 Jun 2010, 2:30 PM
Never mind, resolved at http://stackoverflow.com/questions/3105906/size-element-so-it-is-exactly-as-tall-as-it-needs-to-be-to-not-scroll