Re: [css3-background] Percentages on background-position

Hello,
I think the way background-position works could be improved if we could 
specify a point relative to the image to align with the point specified 
relative to the element.
Right now, percentages and absolute length are incoherent. A 
background-position specified in absolute length units (px, em, 
whatever) always align the point 0 of the image with the point specified 
relative to the element, but if specified as percentage, they align the 
point specified relative to the image with the point specified relative 
to the element. Er. Let's take an example
	background-position: 20px 50%;
Aligns the point (0,50%) of the image with the point (20px,50%) of the 
element. Isn't this what causes the issue with calc()?
Now if we could find a way to specify both the point relative to the 
image and the point relative to the element, calc can be used eventually 
with both. That means we have to specify four values, and find a way to 
separate them correctly (especially if multiple background images are 
used, thus with multiple background positions).

Here is a possible way to solve that:
	background-position: [xi yi /] xe ye[, <background-position>]
Where (xi,yi) is the point relative to the image, and (xe,ye) the point 
relative to the element. If no slash is specified, it reverts to the 
current behaviour (where calc is not useable).

So our earlier example could be rewritten as:
	background-position: 0 50% / 20px 50%;
With that, calc becomes useable with each of the four coordinates.

Jordan Osete

Received on Wednesday, 14 June 2006 07:35:13 UTC