wrote:
> On Mon, 15 Dec 2003 09:43:43 -0500, DU <> wrote:
>
>>ElementRef.clientWidth and ElementRef.clientHeight will return the width
>>and height in pixels excluding padding,
I got this wrong: clientWidth and clientHeight properties include
padding and scrollbar(s) (if present) but not border nor margin.
border and margin in MSIE 6 for
>>Windows, NS 7.x, Mozilla 1.2+, Opera 7.x, K-meleon 0.7+ and other recent
>>browsers (like Safari 1.x, Konqueror 3.x, etc.).
>
>
> Here is what I am seeing:
>
> In Mozilla 1.5 and IE 5.5 (I don't have IE6 installed)
MSIE 5.5 does not comply with the CSS1 box model; if you define a css
width of, say, 150px, then it will include padding and border. MSIE 6
corrects this implementation only if you trigger standards compliant
rendering mode.
: element.clientHeight
> and element.clientWidth both return 0.
>
Too bad you did not post the code by which you saw this. Also I think
you should have explained for what purpose you needed to figure out
these values. An url would have been fine.
I get values for clientWidth and clientHeight for Mozilla 1.6beta, NS
7.1 (based on Mozilla 1.4), K-meleon 0.8.1 and MSIE 6 for windows and
these values are correct and converge: I make sure I trigger standards
compliant rendering mode for MSIE 6. The only small difference I see is
in the width of the vertical scrollbar (and the height of the horizontal
scrollbar): in Mozilla it's 15px while MSIE 6 it's 16px for the windows
classic theme and 18px for the XP theme. Note that scrollbar dimension
is settable in XP Pro and windows 2000 and there is no way to access
this value: this will affect MSIE 5+ and Opera 7.x but not Mozilla-based
browsers where the scrollbar is "fixed" at 16px.
> In Opera 7.23: element.clientHeight and element.clientWidth return the height
> and width including the padding but excluding the border.
>
>
Opera 7.23 will include scrollbar(s) dimension (if present) too in the
calculation of clientWidth and clientHeight.
>
>>If the OP is looking for the content's dimensions, then
>>ElementRef.scrollWidth and ElementRef.scrollHeight will also return the
>>content's width and height in pixels in recent browsers.
>
>
> Here is what I am seeing:
>
Again, I do not see the code you use to reach your conclusions. <shrug>
> In Mozilla 1.5 and IE 5.5: element.scrollWidth and element.scrollHeight return
> the width and height including the padding and border.
>
Not over here. Just content and padding.
> In Opera 7.23: element.scrollWidth returns the width including the padding and
> border.
Yes. There is for sure a bug here.
element.scrollHeight returns the height including the top padding and
> top border but excluding the bottom padding and bottom border (or it includes
> the bottom padding/border and excludes the top padding/border, I don't know
> for sure, but either way, this appears to be a bug).
>
I don't see this but there is a bug for sure in Opera 7's handling of
scrollWidth/scrollHeight.
What is "element" in your testcase? An inline element or a block-level
element? Is your markup and css code valid? Can you post an url showing
your code?
>
> So it looks like there is still no way to get an element's width excluding
> padding and border in IE and Opera.
>
I can not reach your conclusion without seeing specifics, details,
implementation, your code, etc..
In the final analysis, you can set an element's width: this way you can
get it in a reliable way. Many CSS1 box model hacks (to go around MSIE
5.x css1 box model faulty implementation) work more or less that way:
they first figure out if the browser complies with the CSS1 box model
and then they adjust accordingly the measurements of width/height so
that the rendering will be identical in MSIE 5.x, MSIE 6 and other browsers.
DU