associating captions with images

A

Andrew Crowe

Hi,

Is there a recomeded way of associating a piece of caption text with it's
image? (something like the <label> tag for form elements).

It's basically just a usability consideration as it's always recomended to
link together related content (such as using labels for form elements). As
the caption is visible onscreen the longdesc attribute doesn't really seem
to apply.
 
J

Jukka K. Korpela

Andrew Crowe said:
Is there a recomeded way of associating a piece of caption text with
it's image?

No. Such markup has been proposed long ago, but not accepted or
implemented.

If you like, you could use

<table><caption>Caption text</caption>
<tr><td><img src="..." alt="..."></td></tr>
</table>

(and use <caption align="bottom"> if desired)
but it doesn't really mean associating a caption with an image.
 
T

Toby A Inkster

Andrew said:
It's basically just a usability consideration as it's always recomended to
link together related content (such as using labels for form elements). As
the caption is visible onscreen the longdesc attribute doesn't really seem
to apply.

The longdesc attribute can take any URLs -- i.e. fragment identifiers are
allowed:

<img src="potato.jpeg" alt="Potato diagramme" longdesc="#potCaption">

<div class="caption" id="potCaption">
Diagramme showing all the important parts of a potato.
</div>
 
K

Kris

Is there a recomeded way of associating a piece of caption text with
it's image?
[/QUOTE]
If you like, you could use

<table><caption>Caption text</caption>
<tr><td><img src="..." alt="..."></td></tr>
</table>

(and use <caption align="bottom"> if desired)
but it doesn't really mean associating a caption with an image.

Would a table like this not be a similar solution?

<table>
<tr>
<td><img ..></td>
</tr>
<tr>
<th>Caption text</th>
</tr>
</table>
 
J

Jukka K. Korpela

Kris said:
Would a table like this not be a similar solution?

Yes, that's another approach.
<table>
<tr>
<td><img ..></td>
</tr>
<tr>
<th>Caption text</th>
</tr>
</table>

You would probably want to us
th { font-weight: normal; }
since most browsers by default bold <th> elements, and that's usually not
desirable for image captions.
 
K

Kris

<table>
<tr>
<td><img ..></td>
</tr>
<tr>
<th>Caption text</th>
</tr>
</table>

You would probably want to us
th { font-weight: normal; }
since most browsers by default bold <th> elements, and that's usually not
desirable for image captions.[/QUOTE]

And text-align:left; perhaps. Since we are on images and captions
anyway, a note on alt texts to the OP (if he is still reading): since
your caption can in fact contain a good and detailed description of the
photograph, it often suffices to use alt="" on the image. However, if
the image itself has an additional function here, like linking to the
next image, being enclosed in an anchor, use alt="Next image" or
whatever is appropriate.
 
S

Spartanicus

Kris said:
since
your caption can in fact contain a good and detailed description of the
photograph, it often suffices to use alt="" on the image.

Which orphans the caption if accessed sans images, bad idea.
 
J

Jukka K. Korpela

Spartanicus said:
Which orphans the caption if accessed sans images, bad idea.

Besides, it is not the _purpose_ of a caption to present a text
_equivalent_ of the image.

In cases like this, alt="[picture of a cat singing]" or maybe just
alt="[picture 42]" might be the best we can do. It won't help a blind
person, or a person who cannot access the image due to network overload,
but it at least helps _some_ people (like people using a text browser to
download images for local viewing).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top