[whatwg] <link rel=icon width="" height="">
Martin Atkins
mart at degeneration.co.uk
Fri May 2 00:46:56 PDT 2008
Lachlan Hunt wrote:
> Martin Atkins wrote:
>> Lachlan Hunt wrote:
>>> Martin Atkins wrote:
>>>> Could this be said about size as well?
>>>>
>>>> <link type="image/png"
>>>> media="all and (max-width:16px and max-height:16px)">
>>>
>>> No, because the media queries are related to the actual tech specs of
>>> the device, not the image. I'm fairly sure there are no 16x16px
>>> screens in use, at least not for the web. To get appropriate
>>> behaviour for what you're suggesting here would require redefining
>>> and special casing media queries.
>>
>> When I shrink my browser window down so that its viewport is 16x16px
>> (assuming that it'd let me do such a thing) it's quite happy to apply
>> a stylesheet with the above media query. It seems, therefore, that the
>> "width" and "height" constraints relate to the rendering viewport and
>> not to the device.
>
> Yes, I meant "device and viewport" above. But even if you want to apply
> this to a special icon viewport, it still wouldn't work as you expect,
> because what we need is something that describes the properties of the
> image, not the properties of viewport it's being rendered in.
I believe the use-case we're discussing is the selection of an
appropriate icon to display at a size determined by the UA. Specifying
the physical dimensions of the image itself is one way to do that.
Allowing the author to make statements like "this icon is only suitable
at 16x16px" is another.
The latter allows the author rather than the UA the chance to specify
what icon will be best for a given size.
> Given a UA that can display any icon size up to, e.g., 128px square, the
> above media query wouldn't match. But what if the author only provided
> icons up to 64x64px, then no media query would match and no icon would
> be used. However, for this use case, the UA would need to pick the
> highest quality image that is suitable for the environment.
Does it really? If there is no suitable icon, could it not simply select
no icon?
Authors can supply a "catch-all" icon to use for the cases not covered
by the explicit selections:
<link type="image/png"
media="all and (width:16px and height:16px)"
href="icon-16x16.png">
<link type="image/png"
media="all and (width:32px and height:32px)"
href="icon-32x32.png">
<link type="image/svg"
media="all"
href="icon.svg">
Since the 16x16 and 32x32px images are raster images, they are not
suitable for anything except their intrinsic sizes. (an author might
decide that the scaling is acceptable, but that's up to the author) I
imagine that a more realistic use if this technique would be to use min-
and max- together to specify acceptable ranges.
Media queries also have device-aspect-ratio which can be used to specify
the suitable aspect ratio for a non-raster image, and other features
that could potentially be used in future to select for mobile devices
with high-resolution screens.
This would of course need some conflict resolution behavior specified,
since unlike stylesheets one cannot apply several icons at the same
time. Whatever behavior browsers currently exhibit when there are
multiple icons specified ought to be sufficient.
A downside of course is that Google Gears would need to implement media
queries to support this, which is admittedly harder than simply looking
for a width and a height attribute.
More information about the whatwg
mailing list