My question is, can I get the actual size of a div's content when div's width is 'auto' and the content is small enough to fit without resizing.
I know there is a way to find the div's actual size after it's loaded - divObj.offsetWidth/Height.
The problem is that this only works for content which is bigger than the div.
For example,
In this case, when the content is loaded the div will be resized and get a new offsetWidth/Height.Code:<div style="width:30px;">A text that will exceed 30px in width</div>
There will be lots of new lines after the resizement which posses another problem. After loading, the above example will look like this:
Now the example has offsetWidth little more than 30px (~50) and MUCH greater height.Code:A text that will exceed 30px in width
This is not the desired effect. I want the width/height of the content when the div is not resized by the content.
Thanks in advance


Reply With Quote

Bookmarks