How long or detailed should our alternative text be?

Question

How long or detailed should our alternative text be?

Answer

Alt attributes should be accurate and as sufficient as possible. Usually, a few words will be descriptive enough but occasionally a sentence or two will be more appropriate.

For more information on how to create great alternative text, take a look at these examples.

14 Likes

Does it always have to be double quotes when we are writing anything inside a tag, can we use single quotes as well?

3 Likes

The general practice is double quotes when we hand write the code, but when generating code the circumstances will dictate. Personally, I always use double quotes on attributes and generate HTML strings with single quotes.

'<div class="something">content</div>'

or,

`<div class="${classname}">${content}</div>`
12 Likes

Double quote is recommended, because we use single quote as punctuation when writing English sentences as well. That will end your quote unexpectedly.
For example β€˜It’s a Brown Bear!’ as opposed to β€œIt’s a Brown Bear!”. I the first sentence your HTML quote will end with just β€˜It’, because it got confused.

12 Likes