Also sprach Aryeh Gregor:
http://www.princexml.com/howcome/2009/wikipedia/image/
The proposed solution reduces the number of elements from 10 to 6 and
the code size is reduced by more than 50%.
As others have noted, the thumbnails can actually be any size, so we
really do need to use style="" for that (or at least height/width on
the <img>). I guess we could use a class for the relatively common
case, but I don't see the gain, honestly.
The gain is that the code is easier to reuse. When style is set
through a class name, it can be overridden by another style sheet. For
example, when creating these samples:
http://www.princexml.com/samples/#wiki
I wrote a style sheet that used the class names and attached new
styles to them. Given a class name like "w180" I could write a new
rule, e.g.:
.w180 { width: 90px }
Style *attributes* -- on the other hand -- are much harder to deal
with. They always win in competition with other conflicting rules.
Many of them are screen-centric so one is forced to ignore them for
other media. When the style attribute is ignored, there is no hook to
attach style to.
It seems to me that setting the exact width is a rare exception,
and one that shouldn't stand in the way of reusing content.
Setting the height/width on the image is, unfortunately, not ennough
-- the width of the container box must also be constrained. Otherwise,
it will be widened by the caption.
I noticed you removed the " /" closing the
<img> tags -- we use XHTML
1.0 for the moment, so we have to keep that (four more bytes! :) ).
For the same reason, we need to keep alt="" -- it's stupid, since
really the semantics we want is "we have no idea what the alt text
should be since the users didn't specify it" rather than "this
deserves no alt text", but we don't have any way to express the former
in XHTML 1.0. We currently do have the goal of maintaining XHTML 1.0
conformance where possible, stupid though it may be at times.
Understood.
Cheers,
-h&kon
Håkon Wium Lie CTO °þe®ª
howcome(a)opera.com
http://people.opera.com/howcome