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

I think expected behavior is that:

 <style>
  #test-1 {background: #fff; border: solid #000; border-width: 0 10%; }
 </style>

 <div id="test-1">Test 1.</div>

should be rendered identically to:

 <style>
  #test-2 {background: #000; padding: 0 10%; }
  #test-2 > DIV {background: #fff; }
 </style>

 <div id="test-2"><div>Test 2.</div></div>



05.01.2012, 23:55, "Tab Atkins Jr." <jackalmage@gmail.com>:
> 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 21:59:49 UTC