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

On 5/1/12 13:42, Matthew Wilcox wrote:
> http://www.w3.org/TR/CSS2/syndata.html#length-units would seem to
> indicate that % is a length,
I’m failing to see how. Percentages are never mentioned in 4.3.2 and 
they even have their own section (4.3.3).
Every property that accepts percentages in addition to <length>s 
explicitly specifies it, along with what percentages refer to 
(percentages have different semantics for different properties).
>   and
> http://msdn.microsoft.com/en-us/library/ms537660(v=vs.85).aspx
> expressly states that it is a length unit.
MSDN is not a specification. Like any document that *describes* a 
specification, it may be inaccurate due to misunderstandings of its authors.
> Regardless of the naming,
> it is used as one and it makes no sense that border-width does not
> adhere to the behaviour of every other property that takes length
> units (width, padding, etc).
>
> Using calc and box-sizing to get around this seems "quirky" at best,
> and likely to confuse (IMO).
What’s hacky and quirky is using percentages in fluid designs when you 
really want <length>s, just to avoid using calc() and/or box-sizing.

That said, I agree about percentages in border-width, for consistency's 
sake above all. Makes CSS easier to teach and learn.

-- 
Lea Verou (http://lea.verou.me | @LeaVerou)

Received on Thursday, 5 January 2012 16:02:47 UTC