3

The code for creating an image in markdown is

[![enter image description here][-]][-]

What is the description used for? Is it displayed when the image cannot be, or for something else?

1 Answer 1

6

the description part for the image markdown is the alt attribute for the actual html. so the html that's generated for your example would be:

<a href="[URL at -]"><img src="[URL at -]" alt="enter image description here" title></a>

this can be observed in any decent browser's Element Inspector (generally F12 or right clicking on the element and going to Inspect) where you'll see that the alt for the <img> changes to reflect the change you make to the markdown.

the alt is used when an image doesn't appear on screen (such as the image file missing or if images are blocked) and generally if you want valid HTML you should be including the alt attribute for all images

3
  • 4
    Also, if you see missing or default alt text, don't be afraid to edit to fill them in. See this post: Please fill in the Alt text on this site
    – Robotnik Mod
    Commented Dec 1, 2016 at 6:14
  • @Robotnik We need to encourage users to mass edit. It's sad that the top post without alt text has 102 votes. :)
    – user143228
    Commented Dec 3, 2016 at 17:41
  • 5
    Also, the alt attribute is used by screen readers to produce a description of an image which they can read out. Commented Dec 4, 2016 at 10:54

You must log in to answer this question.

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