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

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 UTC