#### 34.2.2 Assigning WAI image attributes with dedicated formats

You can designate a paragraph format whose content will be the text alternative for the next image. For example, suppose you use paragraph format Figname for this purpose:

    [HTMLParaStyles]
    ; Alt makes current para content into alt attribute for next img
    Figname=Alt Delete

Somewhere just before the image you would insert a Figname paragraph containing the name you want displayed as an alternate for the graphic image. Probably you would make the Figname paragraph conditional so it would not appear in print. The Delete property would exclude the paragraph (as such) from HTML output; HTML source would show the text of the Figname paragraph as the value for the alt attribute of the <img> element.

For example, if you were to place a Figname paragraph with the content “Cat in basket” just before the image, in some browsers moving the pointer over the image would display this content in a tooltip. However, in most current browsers, the tooltip shows the content of the title attribute rather than the alt attribute; and the alt text is displayed only when the image is not displayed or is missing.

You can use a similar strategy to provide content for the longdesc attribute of the <img> element; for example, using paragraph format Figdesc for this purpose:.

    [HTMLParaStyles]
    ; Longdesc makes current para content into longdesc attribute
    Figdesc = Longdesc Delete

The Delete property would exclude the paragraph from normal HTML text output.

Previous Topic: 34.2.1 Following WAI guidelines for images

Next Topic: 34.2.3 Assigning WAI image attributes with PI markers

Parent Topic: 34.2 Applying WAI markup to images

Sibling Topics:

34.2.1 Following WAI guidelines for images

34.2.3 Assigning WAI image attributes with PI markers

Table of Contents • Index