I'm one of those people who practices what some consider "dull" and
others consider "elegantly conservative" page design. I appreciate
good traditional typography and standards-compliant liquid displays,
and I only reluctantly experiment with two-column layouts from time to
time.
One component of traditional book typography has always been the
figure/caption combination. I haven't been following discussion on
this topic for a year or two, but last time I did the consensus was
that HTML missed the boat by not including a FIGURE element early on,
and that figure/caption combinations are best done either with nested
DIVs or with TABLE/TH markup. I have elected to use TABLE/TH markup
for now. Some may not agree with that, but that's how I'm marking up
figure/caption combinations at present.
But, in good typography the width of a figure should be a fixed
proportion of the page width: full column, half column, third column,
etc. On most liquid web pages, however, if you narrow the window or
change the font size, image dimensions remain rigid (because we all
know it's good practice to include width="" and height="" attributes
on all IMG elements).
For some time I've wanted to be able to design a page so the figures
will automatically resize and retain their column proportions. I
started thinking in the context of this page from W3C, but I haven't
followed it because it uses DIVs rather than tables:
http://www.w3.org/Style/Examples/007/figures.html
Now that summer's here (long holiday weekend in the US) I've decided
to give it a try, and have been surprised at how easily it can be done
(in this initial test at least; famous last words). Many of these
effects depend on the use of the max-width property which not all
browsers support, but I don't think there is serious breakage in the
absence of max-width. Try this page, which is my current experiment:
http://rjohara.net/coins
It's a page about coins and ancient Greek history. The two
right-floated images in the first part of the page (an old engraving
and an ancient gold coin) are set to display at 50% and 33% of the
column width respectively. If you narrow your browser window these
images will shrink and maintain their 50% and 33% proportions. This
should also be the case if you change font size in your browser: set
browser font-size to 75% and the whole column will narrow (assuming
max-width is supported) and the images will also rescale to retain
their 50% and 33% proportions to the column.
For contrast, go farther down the page to the set of coin images. The
first three have been given the rescaling treatment; the remainder
have not and they will readily overflow the browser window if it is
narrowed.
There are probably many ways to accomplish this. My approach uses two
components. For simple images (not part of figure-tables):
img.half {width: 50%; height: auto;}
<img class="half" style="max-width: 310px; max-height: 217px;"
src="coins/miletus-1835.jpg" align="right" alt="" />
And for figure-tables:
table.third {width: 30%; height: auto;}
table.third img {width: 100%; height: auto;}
<table class="figure third">
<tbody><tr><t d>
<img style="max-width: 222px; max-height: 399px;"
src="coins/electrum-stater.png" border="1" alt="[image]" />
</td></tr>[caption omitted for simplicity]</tbody></table>
It is necessary to insert a style="max-width: nnpx; max-height: nnpx;"
attribute for each image so that the image won't grow beyond its
intrinsic size if the viewer makes the window very large. Some people
might not find this objectionable, but image quality does suffer when
scaled above 100%. While this may seem like an extra step, it's no
more effort than inserting standard width and height attributes.
This may be old hat and some people may have been using this technique
for a while now; as I said, I haven't been following CSS techniques
closely for a year or two. I'd welcome any comments on this approach:
potential failures of degradation, etc. I have not yet tested it on
many browsers; I'm using Mac Mozilla 1.6 (on which it works
beautifully) and Mac IE 5.1 (on which down-scaling works fine but
over-scaling doesn't because max-width isn't supported).
Bob O'Hara (http://rjohara.net)