W3C home > Mailing lists > Public > www-style@w3.org > June 2011

Behaviour of getComputedStyle with box-sizing: border-box

From: Shane Stephens <shans@google.com>
Date: Thu, 16 Jun 2011 13:42:47 +1000
Message-ID: <BANLkTin=XM6eUdgT3ty=PmcOrjdZwOh+zQ@mail.gmail.com>
To: www-style list <www-style@w3.org>
Hi list,

There's a bug against WebKit pointing to a discrepancy in behavior
between WebKit and Firefox when getComputedStyle is used on an element
with box-sizing:border-box. I'm trying to work out which behavior is
correct.

Here's the bug: https://bugs.webkit.org/show_bug.cgi?id=15880

In brief, here's the test:

div {
	box-sizing:  border-box;
	border: 3px solid blue;
	padding: 5px;
	width: 50px;
}

What should the value of
window.getComputedStyle(document.querySelector("div"), null).width be?
Should it be the specified width of the element (50px), or the width
of the content box (34px)?

Cheers,
    -Shane
Received on Thursday, 16 June 2011 03:43:24 GMT

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