W3C home > Mailing lists > Public > www-style@w3.org > April 2009

Re: [Backgrounds/Borders] What to do when a border-image fails to load

From: Brad Kemper <brad.kemper@gmail.com>
Date: Tue, 14 Apr 2009 13:47:52 -0700
Message-Id: <9023A9BD-D9F5-4C02-BB1A-83E2A032BB0C@gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>

On Apr 14, 2009, at 12:37 PM, fantasai <fantasai.lists@inkedblade.net>  
wrote:

> Brad Kemper wrote:
>> With 'background-size', it is most useful for percentage size to  
>> refer to percentage of its container. But with 'border-image' it is  
>> most useful, IMO, for percentage size to refer to percentage of its  
>> intrinsic size, due in part to the extra benefits it confers upon  
>> raster images.
>
> Because border-image isn't already using percentages for something
> more useful doesn't mean we should use its percentages to solve
> this problem.

Right. I never said that was the reason, just that it was the most  
appropriate use for them there. The reason to use percentages there at  
all is because that portion of the border-image value is about  
scaling, and percentage based on original size is the most natural way  
to specify a scaling value. And I also mentioned a couple other  
benefits to doing it that way. I wonder if you would have been more  
open to the idea if I hadn't mentioned the benefits to raster images  
too.

>> Regardless, scaling images for the border will be useful, its just  
>> a matter of which is more useful for what percentage should refer  
>> to, and I think it is more useful and intuitive for sizing  
>> according to intrinsic size. Even for vector images, I think it  
>> would be good to be able to look at the results and be able to say  
>> something like, "oh, that's too big; let's make it three fourths  
>> that size", without having to multiply the border-width by .75. If  
>> my border-width is 3px, I would rather write 75% in that situation  
>> than 2.25 (especially if I wanted to later adjust the fallback  
>> border-width without changing the border-image sizes, which seems  
>> like what might not be an uncommon desire).
>
> You could use lengths for this.

Sure. I could look at the four side image pixel lengths, get out my  
calculator and multiply each by .75, and then write those four px  
values into that spot in the property value. It would be simpler,  
cleaner, and easier if I could just write 75% there though. Why make  
it so hard, when you've already conceded that it's useful to scale all  
four sides by a single arbitrary amount (such as the border-width,  
which is only simple if all four border-widths are the same, or you  
don't mind different sides of the image having different scaling,  
otherwise you have to do math to figure out what it should be for each  
side and then give four numbers)?

> Again, this use case is equally valid
> for backgrounds and list-style-image.

List-style-image doesn't already have a value in it for scaling the  
way border-image does, and background size already has percentages  
used in a way that is more useful for backgrounds than for border-image.

> If we're going to solve it, we
> should solve it with an approach that is applicable to all three.

Well then, if you don't want image scaling handled by border-image  
then that first slash and the numbers immediately after it should be  
removed, since that is what they do to the intrinsic size. It would  
certainly simplify the property. But as long as they are there to  
provide scale, then percentage of intrinsic size is the most obvious,  
straightforward, and very compact way of doing so.


>
>
> ~fantasai
Received on Tuesday, 14 April 2009 20:48:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:46:58 GMT