HTML <img> alt Attributo

❮ Tag HTML <img>

Esempio

Un'immagine con un testo alternativo specificato:

<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">

Definizione e utilizzo

L' altattributo obbligatorio specifica un testo alternativo per un'immagine, se l'immagine non può essere visualizzata.

L' altattributo fornisce informazioni alternative per un'immagine se un utente per qualche motivo non può visualizzarla (a causa di una connessione lenta, un errore srcnell'attributo o se l'utente utilizza uno screen reader).

Suggerimento: per creare una descrizione comando per un'immagine, utilizza l' titleattributo!


Supporto del browser

Attribute
alt Yes Yes Yes Yes Yes

Sintassi

<img alt="text">

Valori di attributo

Value Description
text Specifies an alternate text for an image.

Guidelines for the alt text:

  • The text should describe the image if the image contains information
  • The text should explain where the link goes if the image is inside an <a> element
  • Use alt="" if the image is only for decoration

❮ Tag HTML <img>