What is the advantage of adding empty alt = "? And which alt should alt =" "or alt =" "be used?

What is the advantage of adding null alt = ""? this is just to get tested or has more reasons.

and how to write it?

like that, space

alt="" 

or is it with one space

 alt=" " 
+6
accessibility xhtml screen-readers
source share
4 answers

Other answers indicated standard requirements. Here is an example:

Given the empty alt text, lynx will display:

Given the missing alt attribute, lynx will display:

filename.jpg

You do not want your content to have irrelevant file names scattered throughout the site.

+4
source share

To check your XHTML. Alt is a required attribute on images.

Adding it blank, however, is a sign of laziness from programmers (although I admit that I also do this for images that are not key to navigating the site, like small decorative elements, etc.).

PS If you have decorative elements such as shadow components, you can add some decorations not with images, but as a CSS background, thereby avoiding the need to write alternative text and keeping your layout clean without any content.

+6
source share

For images that do not have suitable alternative text (for example, images that do not have any semantics, such as decorative elements), the alt attribute must be empty. An empty value is empty, not just one space (this is agreement and recommendation, but good).

The alt attribute must be specified for IMG and AREA elements. It is optional for INPUT and APPLET .

Although alternate text can be very useful, it should be handled with care. Authors should follow these guidelines:

  • Do not specify unnecessary alternative text when including images intended for page formatting, for example, alt="red ball" will not be acceptable for an image that adds a red ball to decorate the heading or paragraph. In such cases, the alternative text should be an empty string ("). Authors, in any case, advise against using images to format pages; use stylesheets.
  • Do not include meaningless alternative text (such as "dummy text"). This will not only disappoint users, but also slow down the work of user agents who must convert text to speech or Braille output.

Developers should read the accessibility section for information on how to handle cases of missing alternative text.

- HTML 4 specification. Section 13.8 How to specify alternate text

+3
source share

I will also add this as an answer (initially a comment on another answer), since it makes sense to do this.

Images used to style the page (and therefore do not have the real use of "alt") should be inserted through CSS and the background image and its relatives, and not through markup. Thus, you are doing two good things at once. You save your design in your style sheets, and you save custom code on your page.

Although I believe that β€œsemantics is a god” - moving did not show the failure, which is a div and span, and the inherent ambiguity that they produce, I still think that a div with a background image is better than an img tag for modeling .

0
source share

All Articles