W3C home > Mailing lists > Public > www-style@w3.org > July 2010

Re: [css-background] "background-repeat:round;" and aspect ratio

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 16 Jul 2010 16:08:57 -0700
Message-ID: <AANLkTin6yDjbqHQBpz6E4P_vLjdLJS9MSu1oUzhXpAVc@mail.gmail.com>
To: Brian Manthos <brianman@microsoft.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Fri, Jul 16, 2010 at 4:00 PM, Brian Manthos <brianman@microsoft.com> wrote:
>> Are you willing to specify an explicit size for the image?  If so, then it's
>> relatively easy - just use repeat:space rather than round.
>
> For the purposes of the general example, no.
>
> The idea is that you make a page, author a rule, and use an arbitrary image on an arbitrarily sized element and it should "just work".
>
> Are you saying that this use case isn't directly representable in CSS3?
>
> That was the conclusion I had been leaning toward, but I wanted another opinion.

It all depends on what you want.  If you're okay with it not tiling,
just use background-size:contain and background-position:center.
That'll give you a single copy of the image, sized as large as
possible without clipping, and centered.  That's fine for a very large
image, but not great for images that may be smaller than the element.

There are some cases that can't be covered automatically, but probably
less than you're thinking.

~TJ
Received on Friday, 16 July 2010 23:09:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:29 GMT