2

When I introduce an Image in my answer, there is a description to be given. But then it does not appear in the published version, not even when hovering over the image (would be cool to have something xkcd style).

Is it a bug or is it a feature?

1 Answer 1

4

It is a feature; see this post on the main meta.

The short version is that the description isn't used for a XKCD-style mouseover text, but as a replacement text in case the image cannot be displayed, e.g. by screen readers or if the image doesn't load. That is, the description matches the intended use case for the alt attribute in the HTML spec. Even though the XKCD mouseover text is often called an "alt text", it really uses the title HTML attribute.

One way of including a mouseover text on Stack Exchange sites is as follows

[![Underwater basket weaving - description for screen readers ][1]][1]

[1]: https://i.stack.imgur.com/ngekA.png "Underwater basket weaving - description showing up when hovering over image"

which results in

Underwater basket weaving - description for screen readers

Inspecting the picture element in my browser, the corresponding HTML is

<img src="https://i.stack.imgur.com/ngekA.png" alt="Underwater basket weaving - description for screen readers " title="Underwater basket weaving - description showing up when hovering over image">

1
  • The "description for screen readers" ("alt") also shows up when images don't load for any reason (e.g., network firewall or disabling images to save data).
    – Laurel
    Jan 17 at 18:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .