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

On Thu, Jan 5, 2012 at 3:45 AM, Matthew Wilcox <elvendil@gmail.com> 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.

Can you show an example of a responsive layout that would use
percentage borders?  In my head, I think you'd more often actually
want a standard border, but have some way to let your other
percentages respond to it and only calculate from the remaining space.

The discussion you link to in the archives doesn't actually present a
use-case, other than a vague reference to "scalable designs".

Note that Lea is correct - percentages are not lengths.  Whenever
percentages are present, they're calculated relative to some other
unit, and so effectively have the type of that unit.  This is
*usually* a length, but not necessarily always.

In that vein, given the use-cases you have in mind, should percentage
borders be relative to their respective dimension, or always relative
to the width (like percentage padding is)?

~TJ

Received on Thursday, 5 January 2012 19:56:04 UTC