- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Sun, 05 Nov 2006 16:22:10 +1100
Matthew Raymond wrote: > Lachlan Hunt wrote: >> I disagree. Specifying the size is very good for incremental rendering, >> but the alternatives are awful. >> >> 1. <img ... style="height: 100px; width: 100px;"> >> >> The style attribute is far more presentational than the height and width >> attributes. > > I don't see how either is more or less presentational. The |height| > and |width| attributes are entirely presentational, since their sole > purpose is to define the sizing of the image in the document layout. Using attributes to describe actual metadata about an image that has real practical benefits, for both the author and user, is not presentational in my view. There's even an edge case where specifying incorrect dimensions could still be considered semantic. Unfortunately, I can't find the site I'm thinking of, but I've seen a site somewhere that created art by using small images and stretching them for the pixelation effect. In this case, stretching the image is part of the artwork's artistic value and meaning, not just it's presentation, and it would lose it all if the image were shown at it's actual size. > They do not give the dimensions of the image itself, That all depends on the values the author gives them. Unfortunately, the exact behaviour of how to handle incorrect dimensions was not specified and so browsers implemented it the way they did by stretching the image to fit, instead of any of the other alternatives. >> 2. <img ... id="foo"> >> >> #foo { height: 100px; width: 100px; } > > This is not entirely true: > > | <img src="foo"> > > | img[src="foo"] { height: 100px; width: 100px; } There are dozens of other selectors one could write, but my point was that writing such a thing for each individual image is far too much effort. It's a completely unnecessary level of abstraction. > However, even if this weren't the case, and you has to use |id|, if > we're talking about images that have non-presentational value and their > own unique dimensions, aren't we also talking about content that we > might want to link to directly rather than simply linking to the > containing page? I don't understand the point your trying to make. How is the possibility of linking to the image by itself, rather than within a page, relevant? >> This is simply not feasible in most cases, unless there are very few >> images on the site. Think about flickr, it just wouldn't be possible to >> specify the dimensions of all their images in a stylesheet. > > You can specify the sizes in an additional <style> element. The > primary site styling will be in a separate CSS file, while the > page-specific (and image-specific) styling can remain in the document, > and therefore can be dynamically generated on the server. But what's the point? Even if I agreed with you about height and width being purely presentational, how is including the dimensions in a style element in the page any different from including the attributes on the image element itself, as far as the separation of content and presentation concerned? > Also, Flickr is a bad example, because when you perform a search, > images often have widths and heights of 240, so you could use a |class| > attribute on the images that sets the initial styling... But each individual photo has it's own size, which is what I was getting at. In cases like that where a group of images are all a certain size, then it might be more convenient to specify that once in a stylesheet instead. But that is not always the case. -- Lachlan Hunt http://lachy.id.au/
Received on Saturday, 4 November 2006 21:22:10 UTC