W3C home > Mailing lists > Public > www-style@w3.org > August 2010

RE: [cssom-view] scrollWidth vs clientWidth

From: Sylvain Galineau <sylvaing@microsoft.com>
Date: Fri, 20 Aug 2010 15:08:27 +0000
To: Tab Atkins Jr. <jackalmage@gmail.com>, David Flanagan <david@davidflanagan.com>
CC: Anne van Kesteren <annevk@opera.com>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <045A765940533D4CA4933A4A7E32597E27B5A827@TK5EX14MBXC120.redmond.corp.microsoft.com>
Why does scrollWidth overflow over and beyond the border area ?
I assume this is a bug in the diagram layout ?

> -----Original Message-----
> From: www-style-request@w3.org [mailto:www-style-request@w3.org] On
> Behalf Of Tab Atkins Jr.
> Sent: Wednesday, August 18, 2010 8:15 PM
> To: David Flanagan
> Cc: Anne van Kesteren; www-style@w3.org
> Subject: Re: [cssom-view] scrollWidth vs clientWidth
> 
> On Wed, Aug 18, 2010 at 11:32 AM, David Flanagan
> <david@davidflanagan.com> wrote:
> > Tab Atkins Jr. wrote:
> >>
> >> Changes made: http://www.xanthir.com/diagrams/scrollwidth-

> clientwidth.html
> >>
> >
> > The diagram makes it clear what happens when an element's content is
> wider
> > than the content area. What about the opposite, though: what if the
> content
> > is smaller than the content area.  Is scrollWidth the same as
> clientWidth in
> > that case, or is it smaller?
> 
> Same.  If the content doesn't overflow the content area, then the
> content area is whatever is given by the appropriate CSS rules.
> 
> data:text/html,<!doctype html><div style="width: 400px; padding: 50px;
> border: 2px; overflow:scroll;" id=foo>foo foo</div><script>var el =
> document.getElementById('foo'); alert(el.clientWidth + "\n" +
> el.scrollWidth);</script>
> 
> ~TJ
> 

Received on Friday, 20 August 2010 15:09:12 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:30 GMT