From CSS2 specs:
Quote:
9.5.1 Positioning the float: the 'float' property
'float'
Value: left | right | none | inherit
Initial: none
Applies to: all but positioned elements and generated content
Inherited: no
Percentages: N/A
Media: visual
|
In other words, you can't use float and position at the same time. One or the other. According to the specs, a float needs to have it's width set explicitly. A width of auto will be computed to 0, so you need to set a fix width.
Quote:
10.3.5 Floating, non-replaced elements
If 'left', 'right', 'width', 'margin-left', or 'margin-right' are specified as 'auto', their computed value is '0'.
|
width: auto; works for what you want to achieve in all cases in all browsers but op7 (in which it still works in some cases) as far as I know, however.
Well, that was all about floats...
As for getting the actual width, do you mean from a script? If so, try to use elm.offsetWidth.