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

Re: [css3-background] Distributing space for 'background-repeat: space'

From: Bert Bos <bert@w3.org>
Date: Thu, 3 Apr 2008 12:23:00 +0200
To: W3C style mailing list <www-style@w3.org>
Message-Id: <200804031223.01489.bert@w3.org>

On Tuesday 01 April 2008 09:53, fantasai wrote:
> Bert Bos wrote:
> > The values 'round' and 'space' for the 'background-repeat' property
> > provide two different ways to ensure that a tiled background image
> > is tiled a whole number of times. 'Round' does it by shrinking the
> > image, 'space' by inserting space between the tiles.
> >
> > 'Space' is meant for images that should not be scaled and are
> > fairly small compared to the element. But, of course, the
> > specification must also define what happens if the image is large.
> > The question is how.
> >
> > Let A be the width of the area and W>0 the width of the image. Then
> > the number of times the image fits in the area is N = floor(A/W)
> > and the amount of space we have to distribute is S = A - N*W.
> > (There is a similar story for the height.)
> >
> > The interesting cases to look at are N = 0 and N = 1, ...
> >
> > a3) The image is placed according to 'background-position'.
>
> I think this should be obvious. The same thing happens to 'repeat'

Before we can make it obvious, we should agree that it is the best 
option.

It is true that applying 'background-position' gives the author some 
control over the placement of the single tile, but an author who 
specifies 'background-repeat: space' expects more than one tile and 
adding a 'background-position' when you explicitly don't expect it to 
apply is confusing.

The case of 'repeat' is different, because 'background-position' applies 
in the normal case (more than one tile).

If we choose this option, i.e., applying 'background-position' in case 
there is only one tile, then the default for one tile is top and left. 
Which seems reasonable: if N > 1 there is a tile in that location, too.

So in short: option a3 is OK, but I don't know if it is the best.

In fact, I may have a slight preference for what I called option d: drop 
the 'space' feature and only offer 'round'.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Thursday, 3 April 2008 10:23:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:04 GMT