Re: [css3-background] New Working Draft of CSS Backgrounds and Borders Level 3

fantasai wrote :
> Jordan OSETE wrote:
>> Hello,
>> This is aimed to be a short mail about the way background-position 
>> works.
>> I think the current proposed syntax is quite complex, and somehow 
>> limited.
>> Actually, I did a quick proposal a long time ago. You can find here: 
>> Back then, I did abandon it because I thought it was too complex, but 
>> I still like it somehow. And seeing that the current proposal is also 
>> going to be complex anyway, I'd like to propose it again.
>> It is more powerful than the current syntax, because you can specify 
>> different percentages relative to the bgimage dimensions AND to the 
>> element's dimensions.
>> Sorry, I don't have time to detail it here, please refer to the given 
>> link for the technical details.
>> Please give me some feedback about this.
> I think the current method of interpreting percentages is very intuitive.
> It seems your concern is with calc(). The way percentages are defined in
> the current draft
>     # A percentage for the horizontal offset is relative to (width
>     # background positioning area - width of background image). A
>     # percentage for the vertical offset is relative to (height
>     # background positioning area - height of background image),
>     # where the size of the image is the size given by ‘background-size’.
> already allows them to be combined with absolute lengths. calc(50% + 
> 20px)
> would center the image and then shift it 20px to the side.
> What did you want to accomplish with your proposal that can't be done 
> here?
> ~fantasai
Exactly what Tab Atkins Jr. previously described:
> From what I can tell, the thing that this proposal brings to the table 
> is simply the ability to do percentage-based positioning based on 
> either the image or the element (as opposed to the current method, 
> which does both at once), correct?
Also, there could be other syntaxes that what was proposed. For example 
we could imagine the ability to specify in calc() percentages relative 
to the image (%i), to the element (%e), or both (%), and add or 
substract them at will in calc(). Maybe it would be easier ?

Tab Atkins Jr. wrote:
> How would this syntax interact with the top/bottom/left/right keywords 
> used to specify the edge to use for offsets?
Actually, I do not really understand the need for those keywords, if we 
have calc(). If I understand them correctly, then :
    background-position: right 30% bottom 20px;
is equivalent to:
    background-position: 70% calc( 100% - 20px );

So is the first one just syntaxic sugar for the second ?
To me it seems that it doesn't give more functionality, but adds 
complexity because the same keywords ("right", "top", etc.) can have two 
completely different meanings depending only on their context: 
specifying the position, or specifying the edge to wich the next length 
will offset the image.

Jordan OSETE

Received on Saturday, 11 October 2008 09:10:29 UTC