W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: % is not a valid unit for border-width

From: Lea Verou <leaverou@gmail.com>
Date: Thu, 05 Jan 2012 11:59:40 +0000
Message-ID: <4F0590AC.4000800@gmail.com>
To: mail@matthewwilcox.com
CC: Matthew Wilcox <elvendil@gmail.com>, www-style@w3.org
On 5/1/12 11:45, Matthew Wilcox wrote:
> Please can we get it to be a valid unit?
>
> It makes no sense to arbitrarily limit what a valid length unit is on
> a given element. A length is a length. Why should % not be valid as a
> unit on border-width but valid everywhere else?! It was proposed years
> ago ( http://lists.w3.org/Archives/Public/www-style/2008Jun/0032.html
> ) and shot down despite the use-case being stated. At the moment those
> of us doing nice % based responsive designs can’t use a border in
> them. Not without the math breaking and the layout screwing up
> entirely. That’s caught me out on every single responsive design I’ve
> done, and I’ve had to adjust the design each time.
>
A percentage is not a <length>.

border-width used to be allowed in CSS3, but was removed later on, not 
sure why. Opera was supporting it even before it was added to a spec and 
it removed support to be on par with other UAs.

I agree it would be nice to have, but not something sorely needed. It 
would be good for consistency, if anything: When my students learn CSS, 
they often have trouble understanding why percentages are allowed in any 
other box-model property, but not border.
Keep in mind however that most of the use cases you present, would be 
solved by calc() or box-sizing: border-box;. The latter having pretty 
good support accross browsers too.

-- 
Lea Verou (http://lea.verou.me | @LeaVerou)
Received on Thursday, 5 January 2012 13:42:22 GMT

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