Alternate text

Alternate text is a textual description of an image. Systems often render the alternate text when the reader is using assistive technology or the image cannot be rendered.

Syntax

The syntax for representing this component varies depending on the authoring format:

Authoring format Syntax and example
XDITA

<alt>

<image href="save.gif>
  <alt>Save icon</alt>
</image>
HDITA

@alt

<img alt="Save icon" href="save.gif"/>
MDITA

Text inside square brackets ([]), as part of the markup for an image

![Save icon] (save.gif]

Attributes

The available attributes vary based on the authoring format:

XDITA and HDITA
The following attributes are available on this element: localization attributes, universal attributes, and @keyref.
MDITA
For the MDITA core profile, the equivalent of the XDITA @keyref attribute is supported. For the MDITA extended profile, attributes can be specified by using the HDITA representation.

Examples

This section is non-normative.

Example 1. XDITA example

The following example demonstrates the use of alternate text in an XDITA topic.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD LIGHTWEIGHT DITA Topic//EN" "topic.dtd">
<topic id="intro-product">
  <title>Remote Lighting Overview</title>
  <body>
    <p>The Remote Lighting Network kit includes a wireless smart system that helps make the lighting in your home more energy efficient and easier to manage.</p>
    <fig>
      <image href="images/kit-package.jpg"><alt>Retail package for the Remote Lighting Network kit </alt></image>
    </fig>
  </body>
</topic>
Example 2. HDITA example

The following example demonstrates the use of alternate text in an HDITA topic.

<!DOCTYPE html>
<html>
<head>
  <title>Home</title>
</head>
<body>
  <article id="intro-product">
    <h1>Remote Lighting Overview</h1>
    <p>The Remote Lighting Network kit includes a wireless smart system that helps make the lighting in your home more energy efficient and easier to manage.</p>
    <figure>
      <img src="images/kit-package.jpg" alt="Retail package for the Remote Lighting Network kit" />
</figure>
  </article>
</body>
</html>
Example 3. MDITA example

The following example demonstrates the use of alternate text in an MDITA topic.

# Remote Lighting Overview

The Remote Lighting Network kit includes a wireless smart system that helps make the lighting in your home more energy efficient and easier to manage.

![Retail package for the Remote Lighting Network kit](images/kit-package.jpg)